1var users = [
2 { 'user': 'barney', 'age': 36, 'active': true },
3 { 'user': 'fred', 'age': 40, 'active': false }
4];
5
6_.filter(users, function(o) { return !o.active; });
7// => objects for ['fred']
8
9// The `_.matches` iteratee shorthand.
10_.filter(users, { 'age': 36, 'active': true });
11// => objects for ['barney']
12
13// The `_.matchesProperty` iteratee shorthand.
14_.filter(users, ['active', false]);
15// => objects for ['fred']
16
17// The `_.property` iteratee shorthand.
18_.filter(users, 'active');
19// => objects for ['barney']
1const arr = [
2 {},
3 { hello: null },
4 { hello: false },
5 { hello: 0 },
6 { hello: 'world' }
7];
8
9_.filter(arr, 'hello'); // [{ hello: 'world' }]
1const _quote_filter = _.map(quote_state, (val, key) => { if (val) { return key }})console.log(_quote_filter) //=> [ 'btc', undefined, undefined ]