es-toolkit/benchmarks/performance/isFunction.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

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);
});
});