es-toolkit/benchmarks/performance/get.bench.ts
2024-08-11 12:56:15 +09:00

24 lines
550 B
TypeScript

import { bench, describe } from 'vitest';
import { get as getToolkit } from 'es-toolkit/compat';
import { get as getLodash } from 'lodash';
describe('get with string', () => {
bench('es-toolkit/get', () => {
getToolkit({ a: { b: 3 } }, 'a.b');
});
bench('lodash/get', () => {
getLodash({ a: { b: 3 } }, 'a.b');
});
});
describe('get with string array', () => {
bench('es-toolkit/get', () => {
getToolkit({ a: { b: 3 } }, ['a', 'b']);
});
bench('lodash/get', () => {
getLodash({ a: { b: 3 } }, ['a', 'b']);
});
});