Add is.array overload that supports asserting array items (#119)

Co-authored-by: Pedro Augusto de Paula Barbosa <papb1996@gmail.com>
Co-authored-by: Giora Guttsait <giora111@gmail.com>
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
This commit is contained in:
Arnovsky 2020-07-25 10:11:59 +03:00 committed by GitHub
parent e31db97eab
commit 3f93bf200d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 4 deletions

View file

@ -93,7 +93,15 @@ Note: `is.number(NaN)` returns `false`. This intentionally deviates from `typeof
#### Built-in types
##### .array(value)
##### .array(value, assertion?)
Returns true if `value` is an array and all of its items match the assertion (if provided).
```js
is.array(value); // Validate `value` is an array.
is.array(value, is.number); // Validate `value` is an array and all of its items are numbers.
```
##### .function(value)
##### .buffer(value)
##### .object(value)