indexBy
Create an object from an array of objects indexed by a chosen key
Install
npm install index-by
Usage
var chickens = name: 'Gurli' hunger: 3 name: 'Obik' hunger: 1 name: 'Lui' hunger: 5 ; var indexBy = ; ;// { Gurli: .., Obik: .., Lui: .. } ;// { 'Gurli.3': .., 'Obik.1': .., 'Lui.5': .. } ;// index by the return value of: callback(currentValue, index, array) indexBy;// index by a deep key
All functions take a third argument map
which is an existing map to
amend
License
MIT © src.agency / Thomas Jensen