mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
27 lines
873 B
TypeScript
27 lines
873 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { isArrayLike as isArrayLikeToolkit } from 'es-toolkit/compat';
|
|
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 });
|
|
});
|
|
});
|