Add is.TupleLike#156
This commit is contained in:
parent
94dc715577
commit
a04c656ec7
3 changed files with 70 additions and 0 deletions
17
readme.md
17
readme.md
|
|
@ -410,6 +410,23 @@ function foo() {
|
|||
foo();
|
||||
```
|
||||
|
||||
##### .tupleLike(value, guards)
|
||||
|
||||
A `value` is tuple-like if it matches the provided `guards` array both in `.length` and in types.
|
||||
|
||||
```js
|
||||
is.tupleLike([1],[is.number]);
|
||||
//=> true
|
||||
|
||||
function foo() {
|
||||
const tuple = [1, '2', true]
|
||||
if (is.tupleLike(tuple, [is.number, is.string, is.boolean])) {
|
||||
tuple // [number, string, boolean]
|
||||
}
|
||||
}
|
||||
foo();
|
||||
```
|
||||
|
||||
#### .positiveNumber(value)
|
||||
|
||||
Check if `value` is a number and is more than 0.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue