How to use the indexBy function from lodash

Find comprehensive JavaScript lodash.indexBy code examples handpicked from public code repositorys.

4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
* var keys = [
*   { 'dir': 'left', 'code': 97 },
*   { 'dir': 'right', 'code': 100 }
* ];
*
* _.indexBy(keys, 'dir');
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
*
* _.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
fork icon73
star icon711
watch icon29

+ 5 other calls in file

1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
  self._getUtxos(addressStrs, function(err, utxos) {
    if (err) return next(err);

    if (utxos.length == 0) return cb(null, []);
    allUtxos = utxos;
    utxoIndex = _.indexBy(allUtxos, utxoKey);
    return next();
  });
},
function(next) {
fork icon0
star icon0
watch icon0

+ 13 other calls in file

Other functions in lodash

Sorted by popularity

function icon

lodash.get is the most popular function in lodash (7670 examples)