es-toolkit/benchmarks/performance/property.bench.ts
2024-07-25 12:04:32 +09:00

16 lines
449 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 } });
})
})