2024-07-25 05:43:15 +03:00
|
|
|
import { bench, describe } from 'vitest';
|
|
|
|
import { mapKeys as mapKeysToolkit } from 'es-toolkit';
|
2024-08-10 10:58:00 +03:00
|
|
|
import { mapKeys as mapKeysCompatToolkit } from 'es-toolkit/compat';
|
2024-07-25 05:43:15 +03:00
|
|
|
import { mapKeys as mapKeysLodash } from 'lodash';
|
|
|
|
|
|
|
|
describe('mapKeys', () => {
|
|
|
|
bench('es-toolkit/mapKeys', () => {
|
|
|
|
mapKeysToolkit({ a: 1, b: 2, c: 3 }, (_value, key) => `${key}a`);
|
|
|
|
});
|
|
|
|
|
2024-08-10 10:58:00 +03:00
|
|
|
bench('es-toolkit/compat/mapKeys', () => {
|
|
|
|
mapKeysCompatToolkit({ a: 1, b: 2, c: 3 }, (_value, key) => `${key}a`);
|
|
|
|
});
|
|
|
|
|
2024-07-25 05:43:15 +03:00
|
|
|
bench('lodash/mapKeys', () => {
|
|
|
|
mapKeysLodash({ a: 1, b: 2, c: 3 }, (_value, key) => `${key}a`);
|
|
|
|
});
|
|
|
|
});
|