es-toolkit/benchmarks/performance/mapKeys.bench.ts
seungrodotlee 13c7c7f611
feat(mapKeys,mapValues): add mapKeys and mapValues (#291)
* feat(mapKeys): add mapKeys

* feat(map*): not clone object

* chore. fix names on bench

* feat. pass cloned object to iteratee

* Fix interface

* fix. fix test codes

* fix. fix type error on test

* Add docs

* test: Check test

* bench

* rewrite

* mapKeys

* test: Do not mutate the original function

---------

Co-authored-by: raon0211 <raon0211@toss.im>
2024-07-25 11:43:15 +09:00

14 lines
406 B
TypeScript

import { bench, describe } from 'vitest';
import { mapKeys as mapKeysToolkit } from 'es-toolkit';
import { mapKeys as mapKeysLodash } from 'lodash';
describe('mapKeys', () => {
bench('es-toolkit/mapKeys', () => {
mapKeysToolkit({ a: 1, b: 2, c: 3 }, (_value, key) => `${key}a`);
});
bench('lodash/mapKeys', () => {
mapKeysLodash({ a: 1, b: 2, c: 3 }, (_value, key) => `${key}a`);
});
});