Options
All
  • Public
  • Public/Protected
  • All
Menu

Module reject

Index

Functions Collection

Collection Functions

  • reject<T>(collection: Collection<T>, predicate: CollectionIteratee<T, any>): T[]
  • The opposite of filter this method returns the elements of collection that predicate does not return truthy for.

    since

    5.9.0

    see

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

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

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

    Type Parameters

    • T

    Parameters

    • collection: Collection<T>

      The collection to iterate over.

    • predicate: CollectionIteratee<T, any>

      The function invoked per iteration.

    Returns T[]

    Returns the new filtered array.