Function isOneOf

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

    Type Parameters

    • A
    • B
    • C

    Parameters

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

    Returns TypeGuard<A, B | C>

    Example

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

    const isNullOrUndefined = isOneOf(isNull, isUndefined)

    isNullOrUndefined(null) // true
    isNullOrUndefined(undefined) // true
    isNullOrUndefined(123) // false
  • A factory function that creates a function to check if the payload is one of the given types.

    Type Parameters

    • A
    • B
    • C
    • D

    Parameters

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

    Returns TypeGuard<A, B | C | D>

    Example

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

    const isNullOrUndefined = isOneOf(isNull, isUndefined)

    isNullOrUndefined(null) // true
    isNullOrUndefined(undefined) // true
    isNullOrUndefined(123) // false
  • A factory function that creates a function to check if the payload is one of the given types.

    Type Parameters

    • A
    • B
    • C
    • D
    • E

    Parameters

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

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

    Example

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

    const isNullOrUndefined = isOneOf(isNull, isUndefined)

    isNullOrUndefined(null) // true
    isNullOrUndefined(undefined) // true
    isNullOrUndefined(123) // false
  • A factory function that creates a function to check if the payload is one of the given types.

    Type Parameters

    • A
    • B
    • C
    • D
    • E
    • F

    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>

    Example

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

    const isNullOrUndefined = isOneOf(isNull, isUndefined)

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