mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-01 02:33:54 +03:00
35 lines
983 B
TypeScript
35 lines
983 B
TypeScript
|
import { bench, describe } from 'vitest';
|
||
|
import { isLength as isLengthToolkit } from 'es-toolkit';
|
||
|
import { isLength as isLengthLodash } from 'lodash';
|
||
|
|
||
|
describe('isLength', () => {
|
||
|
bench('es-toolkit/isLength', () => {
|
||
|
isLengthToolkit(100);
|
||
|
isLengthToolkit(0);
|
||
|
isLengthToolkit(-1);
|
||
|
isLengthToolkit(1.5);
|
||
|
isLengthToolkit(Number.MAX_SAFE_INTEGER);
|
||
|
isLengthToolkit(Number.MAX_SAFE_INTEGER + 1);
|
||
|
isLengthToolkit('100');
|
||
|
isLengthToolkit(true);
|
||
|
isLengthToolkit(null);
|
||
|
isLengthToolkit(undefined);
|
||
|
isLengthToolkit({});
|
||
|
isLengthToolkit([]);
|
||
|
});
|
||
|
bench('lodash/isLength', () => {
|
||
|
isLengthLodash(100);
|
||
|
isLengthLodash(0);
|
||
|
isLengthLodash(-1);
|
||
|
isLengthLodash(1.5);
|
||
|
isLengthLodash(Number.MAX_SAFE_INTEGER);
|
||
|
isLengthLodash(Number.MAX_SAFE_INTEGER + 1);
|
||
|
isLengthLodash('100');
|
||
|
isLengthLodash(true);
|
||
|
isLengthLodash(null);
|
||
|
isLengthLodash(undefined);
|
||
|
isLengthLodash({});
|
||
|
isLengthLodash([]);
|
||
|
});
|
||
|
});
|