Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/libpkgx/src/deps.ts>is_what.isOneOf

`import`… but with pkging powers
Very Popular
Go to Latest
function is_what.isOneOf
import { is_what } from "https://deno.land/x/libpkgx@v0.18/src/deps.ts";
const { isOneOf } = is_what;

A factory function that creates a function to check if the payload is one of the given types.

Examples

import { isOneOf, isNull, isUndefined } from 'is-what'

const isNullOrUndefined = isOneOf(isNull, isUndefined)

isNullOrUndefined(null) // true isNullOrUndefined(undefined) // true isNullOrUndefined(123) // false

Type Parameters

A
B extends A
C extends A

Parameters

a: TypeGuard<A, B>
b: TypeGuard<A, C>

Returns

TypeGuard<A, B | C>

A factory function that creates a function to check if the payload is one of the given types.

Examples

import { isOneOf, isNull, isUndefined } from 'is-what'

const isNullOrUndefined = isOneOf(isNull, isUndefined)

isNullOrUndefined(null) // true isNullOrUndefined(undefined) // true isNullOrUndefined(123) // false

Type Parameters

A
B extends A
C extends A
D extends A

Parameters

a: TypeGuard<A, B>
b: TypeGuard<A, C>
c: TypeGuard<A, D>

Returns

TypeGuard<A, B | C | D>

A factory function that creates a function to check if the payload is one of the given types.

Examples

import { isOneOf, isNull, isUndefined } from 'is-what'

const isNullOrUndefined = isOneOf(isNull, isUndefined)

isNullOrUndefined(null) // true isNullOrUndefined(undefined) // true isNullOrUndefined(123) // false

Type Parameters

A
B extends A
C extends A
D extends A
E extends A

Parameters

a: TypeGuard<A, B>
b: TypeGuard<A, C>
c: TypeGuard<A, D>
d: TypeGuard<A, E>

Returns

TypeGuard<A,
| B
| C
| D
| E
>

A factory function that creates a function to check if the payload is one of the given types.

Examples

import { isOneOf, isNull, isUndefined } from 'is-what'

const isNullOrUndefined = isOneOf(isNull, isUndefined)

isNullOrUndefined(null) // true isNullOrUndefined(undefined) // true isNullOrUndefined(123) // false

Type Parameters

A
B extends A
C extends A
D extends A
E extends A
F extends A

Parameters

a: TypeGuard<A, B>
b: TypeGuard<A, C>
c: TypeGuard<A, D>
d: TypeGuard<A, E>
e: TypeGuard<A, F>

Returns

TypeGuard<A,
| B
| C
| D
| E
| F
>