Function reject

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

    Type Parameters

    • T

    Parameters

    • collection: Collection<T>

      The collection to iterate over.

    • predicate: CollectionIteratee<T>

      The function invoked per iteration.

    Returns T[]

    Returns the new filtered array.

    5.9.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']