_.findindex lodash code example

Example 1: lodash _ findindex examples

var users = [  { 'user': 'barney',  'active': false },  { 'user': 'fred',    'active': false },  { 'user': 'pebbles', 'active': true }]; _.findIndex(users, function(chr) {  return chr.user == 'barney';});// => 0 // using the `_.matches` callback shorthand_.findIndex(users, { 'user': 'fred', 'active': false });// => 1 // using the `_.matchesProperty` callback shorthand_.findIndex(users, 'active', false);// => 0 // using the `_.property` callback shorthand_.findIndex(users, 'active');// => 2

Example 2: lodash map

_.each(markets, (obj, key) => {   obj.symbol = key})console.log(markets)//=> {       'BTC/USD': { buys: 0, sells: 3, symbol: 'BTC/USD' },       'DASH/BTC': { buys: 3, sells: 1, symbol: 'DASH/BTC' },       'ETH/BTC': { buys: 3, sells: 2, symbol: 'ETH/BTC' }    }