Function reject

  • The opposite of filter. It returns a list with the elements that satisfy the condition removed.

    Example

    import * as A from "flurp/array";
    import * as N from "flurp/number";

    const tossOutNegative = A.reject(N.isNegative);
    tossOutNegative([0, 2, -4, 6, 8]); // [0, 2, 6, 8]

    Type Parameters

    • T

    Parameters

    • condition: ((x: T) => boolean)
        • (x: T): boolean
        • Parameters

          • x: T

          Returns boolean

    Returns ((arr: readonly T[]) => T[])

      • (arr: readonly T[]): T[]
      • Parameters

        • arr: readonly T[]

        Returns T[]