Function reject

  • The opposite of filter this method returns the elements of collection that predicate does not return truthy for.

    Type Parameters

    • T
    • S

    Parameters

    • array: T[]

      The collection to iterate over.

    • predicate: ArrayIteratorTypeGuard<T, S>

      The function invoked per iteration.

    Returns S[]

    Returns the new filtered array.

    0.1.0

    pull, pullAll, pullAllBy, pullAllWith, pullAt, remove, filter

    const users = [
    { 'user': 'barney', 'active': true },
    { 'user': 'fred', 'active': false }
    ]

    reject(users, ({ active }) => active)
    // => objects for ['fred']