Test name | Executions per second |
---|---|
Lodash with objects | 4689173.5 Ops/sec |
Native flat with objects | 828872.4 Ops/sec |
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
const arr = [[{ name: 'bort' }, { name: 'dort' }, { name: 'bort' }, { name: 'dort' }], [{ name: 'bort' }, { name: 'dort' }, { name: 'bort' }, { name: 'dort' }]];
_.flatten(arr);
const arr = [[{ name: 'bort' }, { name: 'dort' }, { name: 'bort' }, { name: 'dort' }], [{ name: 'bort' }, { name: 'dort' }, { name: 'bort' }, { name: 'dort' }]];
arr.flat();