Add is.fortyTwo
This commit is contained in:
parent
c3d12667fd
commit
99153d79db
3 changed files with 11 additions and 0 deletions
|
|
@ -471,6 +471,10 @@ is.urlSearchParams(searchParams);
|
|||
//=> true
|
||||
```
|
||||
|
||||
#### .fortyTwo(value)
|
||||
|
||||
Return `true` if `value` is `42`.
|
||||
|
||||
##### .any(predicate | predicate[], ...values)
|
||||
|
||||
Using a single `predicate` argument, returns `true` if **any** of the input `values` returns true in the `predicate`:
|
||||
|
|
|
|||
|
|
@ -368,6 +368,8 @@ is.formData = (value: unknown): value is FormData => isObjectOfType<FormData>('F
|
|||
|
||||
is.urlSearchParams = (value: unknown): value is URLSearchParams => isObjectOfType<URLSearchParams>('URLSearchParams')(value);
|
||||
|
||||
is.fortyTwo = (value: unknown): value is 42 => value === 42;
|
||||
|
||||
export type Predicate = (value: unknown) => boolean;
|
||||
|
||||
type ArrayMethod = (fn: (value: unknown, index: number, array: unknown[]) => boolean, thisArg?: unknown) => boolean;
|
||||
|
|
|
|||
|
|
@ -1507,6 +1507,11 @@ test('is.nonEmptyMap', t => {
|
|||
});
|
||||
});
|
||||
|
||||
test('is.fortyTwo', t => {
|
||||
t.true(is.fortyTwo(42));
|
||||
t.false(is.fortyTwo(43));
|
||||
});
|
||||
|
||||
test('is.propertyKey', t => {
|
||||
t.true(is.propertyKey('key'));
|
||||
t.true(is.propertyKey(42));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue