var users = [
{ 'user': 'Ankit', 'active': true },
{ 'user': 'John', 'active': false },
{ 'user': 'Deo', 'active': false }
];
const result = _.dropRightWhile(users, function (o) {
return !o.active;
});
// { 'user': 'Ankit', 'active': true }
It cretes a slice of array which excludes some elements from the end. Elements are removed or deleted from the end until the predicate return falsey values.
Example Demo
0 Comments