es-toolkit/benchmarks/performance/isLength.bench.ts
오병진 caedf69aed
feat(isLength): Add isLength (#245)
* feat(predicate, compat, isLength): impl isLength

Signed-off-by: sunrabbit123 <qudwls185@naver.com>

* docs: change compatibility mark

Signed-off-by: sunrabbit123 <qudwls185@naver.com>

* test(isLength, compat): add test case link

Signed-off-by: sunrabbit123 <qudwls185@naver.com>

* docs(predicate, isLength): add route path on vitepress

Signed-off-by: sunrabbit123 <qudwls185@naver.com>

* Update docs/ko/reference/predicate/isLength.md

---------

Signed-off-by: sunrabbit123 <qudwls185@naver.com>
Co-authored-by: Sojin Park <raon0211@gmail.com>
Co-authored-by: Sojin Park <raon0211@toss.im>
2024-07-20 11:18:20 +09:00

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([]);
});
});