Lodash - overSome 方法



語法

_.overSome([predicates=[_.identity]])

建立一個函式,當使用它接受到的的引數呼叫任何謂詞時,檢查這些謂詞是否返回真值。

引數

  • [predicates=[_.identity]] (...(Function|Function[])) − 要檢查的謂詞。

輸出

  • (Function) − 返回新的函式。

示例

var _ = require('lodash');
var func = _.overSome([Boolean, isFinite]);

console.log(func('1'));
console.log(func(null));
console.log(func(NaN));

將以上程式儲存在 tester.js 中。執行以下命令執行此程式。

命令

\>node tester.js

輸出

true
true
false
lodash_util.htm
廣告
© . All rights reserved.