Test name | Executions per second |
---|---|
reduce | 1136.1 Ops/sec |
map + fromEntries | 697.8 Ops/sec |
reduce spread | 57.0 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(),
}), {});