Determines whether the sequence contains no elements that satisfy the optional predicate.
Type of elements within the source iterable.
source
The source iterable.
Optional
Optional predicate evaluated against each element. When omitted, the function returns true if the sequence is empty.
true
true when no element satisfies the predicate (or when the sequence is empty and no predicate is provided); otherwise, false.
false
This is more efficient than negating any with a predicate because iteration stops as soon as a matching element is found.
any
const numbers = [1, 3, 5];const noEvens = none(numbers, x => x % 2 === 0);console.log(noEvens); // trueconst mixedNumbers = [1, 2, 3, 5];const noEvens2 = none(mixedNumbers, x => x % 2 === 0);console.log(noEvens2); // false Copy
const numbers = [1, 3, 5];const noEvens = none(numbers, x => x % 2 === 0);console.log(noEvens); // trueconst mixedNumbers = [1, 2, 3, 5];const noEvens2 = none(mixedNumbers, x => x % 2 === 0);console.log(noEvens2); // false
Determines whether the sequence contains no elements that satisfy the optional predicate.