Files
30-seconds-of-code/snippets/none.md
Angelos Chalaris 9cbdbe5656 Updated all, any, none
Merged them with their by counterparts.
2018-02-16 13:43:43 +02:00

16 lines
422 B
Markdown

### none
Returns `true` if the provided predicate function returns `false` for all elements in a collection, `false` otherwise.
Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
Omit the second argument, `fn`, to use `Boolean` as a default.
```js
const none = (arr, fn = Boolean) => !arr.some(fn);
```
```js
none([0, 1, 3, 0], x => x == 2); // true
none([0, 0, 0]); // true
```