Test name | Executions per second |
---|---|
reduce | 3184.5 Ops/sec |
map + fromEntries | 1275.3 Ops/sec |
reduce spread | 106.7 Ops/sec |
var data = { Array.from(Array(10000).keys()) };
Object.entries(data).reduce((acc, [k, v]) => {
acc[k] = v.toString();
return acc;
}, {});
Object.fromEntries(Object.entries(data).map(([k, v]) => ([k, v.toString()])));
Object.entries(data).reduce((acc, [k, v]) => ({
acc,
[k]: v.toString(),
}), {});