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:
parent
e31db97eab
commit
3f93bf200d
3 changed files with 54 additions and 4 deletions
10
readme.md
10
readme.md
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue