lodash in arrat code example
Example 1: lodash find object in array
var users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false },
{ 'user': 'pebbles', 'age': 1, 'active': true }
];
_.find(users, function(o) { return o.age < 40; });
Example 2: Lodash filter
var users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false }
];
_.filter(users, function(o) { return !o.active; });
_.filter(users, { 'age': 36, 'active': true });
_.filter(users, ['active', false]);
_.filter(users, 'active');