es-toolkit/benchmarks/performance/isArrayLike.bench.ts
Dayong Lee bd7cb34cb7
feat(isArrayLike,isFunction): Add isArrayLike and isFunction with compatibility (#265)
* add isArrayLike and isFunction

* Add bench

* Add create arguments function

* Add isArrayLike function

* Add compatibility

* Change sub title to korean in isLength docs

* Add docs

* Fix typo error

* add toArgs testcase and remove a unusable expression

---------

Co-authored-by: Sojin Park <raon0211@toss.im>
2024-07-21 10:51:09 +09:00

27 lines
866 B
TypeScript

import { bench, describe } from 'vitest';
import { isArrayLike as isArrayLikeToolkit } from 'es-toolkit';
import { isArrayLike as isArrayLikeLodash } from 'lodash';
describe('isArrayLike', () => {
bench('es-toolkit/isArrayLike', () => {
isArrayLikeToolkit(true);
isArrayLikeToolkit(new Date());
isArrayLikeToolkit(new Error());
isArrayLikeToolkit({ a: 1 });
isArrayLikeToolkit(1);
isArrayLikeToolkit(/x/);
isArrayLikeToolkit(Array.from({ length: 10000 }));
isArrayLikeToolkit({ length: 1000 });
});
bench('lodash/isArrayLike', () => {
isArrayLikeLodash(true);
isArrayLikeLodash(new Date());
isArrayLikeLodash(new Error());
isArrayLikeLodash({ a: 1 });
isArrayLikeLodash(1);
isArrayLikeLodash(/x/);
isArrayLikeLodash(Array.from({ length: 10000 }));
isArrayLikeLodash({ length: 1000 });
});
});