mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
caedf69aed
* 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>
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([]);
|
|
});
|
|
});
|