es-toolkit/benchmarks/omitBy.bench.ts

18 lines
573 B
TypeScript
Raw Normal View History

2024-04-25 14:56:13 +03:00
import { omitBy as omitByToolkit } from 'es-toolkit';
import { omitBy as omitByLodash } from 'lodash';
import { bench, describe } from 'vitest';
2024-04-25 14:56:13 +03:00
describe('omitBy', () => {
bench('es-toolkit/omitBy', () => {
2024-04-25 14:56:13 +03:00
const obj = { a: 1, b: 'omit', c: 3 };
const shouldOmit = (value: number | string) => typeof value === 'string';
2024-04-25 14:56:13 +03:00
omitByToolkit(obj, shouldOmit);
});
2024-04-25 14:56:13 +03:00
bench('lodash/omitBy', () => {
2024-04-25 14:56:13 +03:00
const obj = { a: 1, b: 'omit', c: 3 };
const shouldOmit = (value: number | string) => typeof value === 'string';
2024-04-25 14:56:13 +03:00
omitByLodash(obj, shouldOmit);
});
});