@jonahsnider/util

    Function not

    • Create a new function that calls the provided fn and negates the result.

      Time complexity: O(1)

      Space complexity: O(1)

      Type Parameters

      • T extends (...parameters: any[]) => boolean

      Parameters

      • fn: T

        Function to negate the return value of

      Returns (...parameters: Parameters<T>) => boolean

      The inverted return value of fn

      Higher order

      import { nullish } from '@jonahsnider/util';

      const array = [0, null, '', undefined, false];

      array.filter(not(nullish)); // [0, '', false]
    MMNEPVFCICPMFPCPTTAAATR