mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-01 10:45:08 +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>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { bench, describe } from 'vitest';
|
|
import { isFunction as isFunctionToolkit } from 'es-toolkit';
|
|
import { isFunction as isFunctionLodash } from 'lodash';
|
|
|
|
describe('isFunction', () => {
|
|
bench('es-toolkit/isFunction', () => {
|
|
isFunctionToolkit(true);
|
|
isFunctionToolkit(new Date());
|
|
isFunctionToolkit(new Error());
|
|
isFunctionToolkit({ a: 1 });
|
|
isFunctionToolkit(1);
|
|
isFunctionToolkit(/x/);
|
|
isFunctionToolkit(Array.from({ length: 10000 }));
|
|
isFunctionToolkit(async function () {});
|
|
isFunctionToolkit(function* () {});
|
|
isFunctionToolkit(Proxy);
|
|
isFunctionToolkit(Int8Array);
|
|
isFunctionToolkit(() => {});
|
|
isFunctionToolkit(Array.prototype.slice);
|
|
});
|
|
bench('lodash/isFunction', () => {
|
|
isFunctionLodash(true);
|
|
isFunctionLodash(new Date());
|
|
isFunctionLodash(new Error());
|
|
isFunctionLodash({ a: 1 });
|
|
isFunctionLodash(1);
|
|
isFunctionLodash(/x/);
|
|
isFunctionLodash(Array.from({ length: 10000 }));
|
|
isFunctionLodash(async function () {});
|
|
isFunctionLodash(function* () {});
|
|
isFunctionLodash(Proxy);
|
|
isFunctionLodash(Int8Array);
|
|
isFunctionLodash(() => {});
|
|
isFunctionLodash(Array.prototype.slice);
|
|
});
|
|
});
|