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

x/is_what/dist/index.d.ts>isOneOf

JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.
Go to Latest
function isOneOf
import { isOneOf } from "https://deno.land/x/is_what@v4.1.15/dist/index.d.ts";

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
>