es-toolkit/benchmarks/performance/mapValues.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
412 B
TypeScript

import { bench, describe } from 'vitest';
import { mapValues as mapValuesToolkit } from 'es-toolkit';
import { mapValues as mapValuesLodash } from 'lodash';
describe('mapValues', () => {
bench('es-toolkit/mapValues', () => {
mapValuesToolkit({ a: 1, b: 2, c: 3 }, value => `${value}a`);
});
bench('lodash/mapValues', () => {
mapValuesLodash({ a: 1, b: 2, c: 3 }, value => `${value}a`);
});
});