es-toolkit/benchmarks/performance/property.bench.ts
2024-08-11 10:54:13 +09:00

16 lines
452 B
TypeScript

import { property as propertyToolkit } from 'es-toolkit/compat';
import { property as propertyLodash } from 'lodash';
import { bench, describe } from 'vitest';
describe('property', () => {
bench('es-toolkit/property', () => {
const getValue = propertyToolkit('a.b');
getValue({ 'a.b': 1, a: { b: 1 } });
});
bench('lodash/property', () => {
const getValue = propertyLodash('a.b');
getValue({ 'a.b': 1, a: { b: 1 } });
});
});