mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-29 04:34:01 +03:00
bd7cb34cb7
* 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>
27 lines
866 B
TypeScript
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 });
|
|
});
|
|
});
|