es-toolkit/benchmarks/omitBy.bench.ts
Jun 3cc1a03519
chore(*): Add codspeed for benchmark visualization (#75)
* chore: add codspeed

* chore: fix the benchmark file to clearly distinguish between the comparison targets

* chore: fix typo
2024-06-18 10:40:07 +09:00

18 lines
573 B
TypeScript

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