Creates a slice of array with elements taken from the end. Elements are taken until predicate returns falsey. The predicate is invoked with three arguments: (value, index, array).
array
predicate
The array to query.
The function invoked per iteration.
Returns the slice of array.
3.0.0
const users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred', 'active': true }, { 'user': 'pebbles', 'active': true }]takeRightWhile(users, ({ active }) => active)// => objects for ['fred', 'pebbles'] Copy
const users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred', 'active': true }, { 'user': 'pebbles', 'active': true }]takeRightWhile(users, ({ active }) => active)// => objects for ['fred', 'pebbles']
Creates a slice of
array
with elements taken from the end. Elements are taken untilpredicate
returns falsey. The predicate is invoked with three arguments: (value, index, array).