Creates a slice of array excluding elements dropped from the end. Elements are dropped 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.
5.16.0
const users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred', 'active': true }, { 'user': 'pebbles', 'active': true }]dropRightWhile(users, ({ active }) => active)// => objects for ['barney'] Copy
const users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred', 'active': true }, { 'user': 'pebbles', 'active': true }]dropRightWhile(users, ({ active }) => active)// => objects for ['barney']
Creates a slice of
array
excluding elements dropped from the end. Elements are dropped untilpredicate
returns falsey. The predicate is invoked with three arguments: (value, index, array).