当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

none

优质
小牛编辑
132浏览
2023-12-01

Checks whether NO elements in this sequence satisfy the given predicate (the opposite of Sequence#all, basically).

Signature

Sequence.none = function(predicate) { /*...*/ }
Sequence.none = function none(predicate) {
  return !this.any(predicate);
}
NameType(s)Description
predicateFunction?

A function to call on (potentially) every element in this sequence.

returnsboolean

True if predicate does not return true for any element in the sequence. False if predicate returns true for at least one element.

Examples

var numbers = [1, 2, 3, 4, 5];

Lazy(numbers).none()           // => false
Lazy(numbers).none(isEven)     // => false
Lazy(numbers).none(isNegative) // => true
Lazy([]).none(isEven)          // => true
Lazy([]).none(isNegative)      // => true
Lazy([]).none()                // => true