主题
overEvery
js
_.overEvery([predicates=[_.identity]])创建一个函数,检查在使用收到的参数调用时,所有 predicates 是否都返回真值。
¥Creates a function that checks if all of the predicates return truthy when invoked with the arguments it receives.
以下简写可用于提供谓词。传递 Object,它将用作 _.matches 的参数来创建谓词。传递 _.matchesProperty 的参数 Array,将使用它们创建谓词。
¥Following shorthands are possible for providing predicates. Pass an Object and it will be used as an parameter for _.matches to create the predicate. Pass an Array of parameters for _.matchesProperty and the predicate will be created using them.
新增于
¥Since
4.0.0
参数
¥Arguments
[predicates=[_.identity]](...(函数|函数[])):属性标识符。¥
[predicates=[_.identity]](...(Function|Function[])): The predicates to check.
返回
¥Returns
(函数):返回新函数。
¥(Function): Returns the new function.
示例
¥Example
js
var func = _.overEvery([Boolean, isFinite]);
func('1');
// => true
func(null);
// => false
func(NaN);
// => false