Lodash - overEvery 方法
語法
_.overEvery([predicates=[_.identity]])
建立一個函式來檢查,當使用其接收到的引數呼叫所有謂詞條件函式時,是否它們都返回真值。
引數
[predicates=[_.identity]] (...(Function|Function[])) − 要檢查的謂詞條件函式。
輸出
(Function) − 返回新函式。
示例
var _ = require('lodash');
var func = _.overEvery([Boolean, isFinite]);
console.log(func('1'));
console.log(func(null));
console.log(func(NaN));
將上述程式儲存在 **tester.js** 中。執行以下命令來執行該程式。
命令
\>node tester.js
輸出
true false false
lodash_util.htm
廣告