Function not

  • NOT operator for functions.

    Type Parameters

    • Args extends readonly unknown[]

    Parameters

    • fn: ((...args) => boolean)

      function to negate

        • (...args): boolean
        • Parameters

          Returns boolean

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

    a function that negates the result of the input function

      • (...args): boolean
      • Parameters

        Returns boolean

    Example

    const isEven = (n: number) => n % 2 === 0
    const isOdd = not(isEven)
    isOdd(2) // returns false

Generated using TypeDoc