Test name | Executions per second |
---|---|
Native | 477461.3 Ops/sec |
Lodash.js cloneDeep | 192071.4 Ops/sec |
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
var arr = [
{
"id": 52
},
{
"id": 76
},
{
"id": 13
},
{
"id": 96
},
{
"id": 27
},
{
"id": 8
},
{
"id": 23
},
{
"id": 63
},
{
"id": 25
}
]
arr.map(elem => ({
elem,
className: 'pizza'
}))
_.cloneDeep(arr).map(elem => {
elem.className = 'pizza';
return elem;
})