es-toolkit/benchmarks/performance/clamp.bench.ts
2024-07-17 11:47:39 +09:00

16 lines
359 B
TypeScript

import { bench, describe } from 'vitest';
import { clamp as clampToolkit } from 'es-toolkit';
import { clamp as clampLodash } from 'lodash';
describe('clamp', () => {
bench('es-toolkit/clamp', () => {
clampToolkit(10, 5, 15);
clampToolkit(10, 5);
});
bench('lodash/clamp', () => {
clampLodash(10, 5, 15);
clampLodash(10, 5);
});
});