Iterates over elements of array, returning an array of all elements predicate returns truthy for. The predicate is invoked with three arguments: (value, index, array).
array
predicate
Note: Unlike remove, this method returns a new array.
remove
The array to iterate over.
The function invoked per iteration.
Returns the new filtered array.
5.0.0
pull, pullAll, pullAllBy, pullAllWith, pullAt, remove, reject
const users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred', 'active': false }]filter(users, ({ active }) => active)// => objects for ['barney'] Copy
const users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred', 'active': false }]filter(users, ({ active }) => active)// => objects for ['barney']
Iterates over elements of
array
, returning an array of all elementspredicate
returns truthy for. The predicate is invoked with three arguments: (value, index, array).Note: Unlike
remove
, this method returns a new array.