Test name | Executions per second |
---|---|
Lodash | 360938.0 Ops/sec |
Native | 984349.5 Ops/sec |
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
var max2 = 100;
var data = [];
for (var i = 0; i <= max2; i++) { data.push({ id: i }); }
_.groupBy(data, ({ id }) => id)
data.reduce((acc, item) => {
acc[item.id] = item;
return acc;
}, {})