Add is.any() and is.all() methods (#19)

This commit is contained in:
Kodie Grantham 2017-10-11 04:26:45 -05:00 committed by Sindre Sorhus
parent 75ac3cd574
commit 651f434eab
3 changed files with 81 additions and 0 deletions

View file

@ -158,6 +158,30 @@ Check if `value` is `Infinity` or `-Infinity`.
Returns `true` if `value` is falsy or an empty string, array, object, map, or set.
##### .any(predicate, ...values)
Returns `true` if **any** of the input `values` returns true in the `predicate`:
```js
is.any(is.string, {}, true, '🦄');
//=> true
is.any(is.boolean, 'unicorns', [], new Map());
//=> false
```
##### .all(predicate, ...values)
Returns `true` if **all** of the input `values` returns true in the `predicate`:
```js
is.all(is.object, {}, new Map(), new Set());
//=> true
is.all(is.string, '🦄', [], 'unicorns');
//=> false
```
## FAQ
### Why yet another type checking module?