Function or

  • OR operator for functions.

    Type Parameters

    • Args extends readonly unknown[]

    Parameters

    • Rest ...fns: ((...args) => boolean)[]

      functions to combine

    Returns ((...args) => boolean)

    a function that returns true if any of the input functions return true

      • (...args): boolean
      • Parameters

        Returns boolean

    Example

    const isEven = (n: number) => n % 2 === 0
    const isPositive = (n: number) => n > 0
    const isPositiveOrEven = or(isEven, isPositive)
    isPositiveOrEven(2) // returns true
    isPositiveOrEven(3) // returns true

Generated using TypeDoc