GroupBy (lodash)
JS
S
JavaScriptExample of a groupBy using lodash methods
1 const groupedByMakers = _.chain(cars)
2 .groupBy('maker')
3 .map((value, key) => ({ maker: key, cars: value }))
4 .value();Created on 7/8/2021
Example of a groupBy using lodash methods
1 const groupedByMakers = _.chain(cars)
2 .groupBy('maker')
3 .map((value, key) => ({ maker: key, cars: value }))
4 .value();Created on 7/8/2021