Add Type tests
This commit is contained in:
parent
a04c656ec7
commit
b12fcef980
2 changed files with 46 additions and 2 deletions
|
|
@ -415,15 +415,18 @@ foo();
|
|||
A `value` is tuple-like if it matches the provided `guards` array both in `.length` and in types.
|
||||
|
||||
```js
|
||||
is.tupleLike([1],[is.number]);
|
||||
is.tupleLike([1], [is.number]);
|
||||
//=> true
|
||||
```
|
||||
|
||||
```js
|
||||
function foo() {
|
||||
const tuple = [1, '2', true]
|
||||
const tuple = [1, '2', true];
|
||||
if (is.tupleLike(tuple, [is.number, is.string, is.boolean])) {
|
||||
tuple // [number, string, boolean]
|
||||
}
|
||||
}
|
||||
|
||||
foo();
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue