mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
25 lines
630 B
TypeScript
25 lines
630 B
TypeScript
|
import { bench, describe } from 'vitest';
|
||
|
import { rest as restToolkit } from 'es-toolkit';
|
||
|
import { rest as restCompat } from 'es-toolkit/compat';
|
||
|
import { rest as restLodash } from 'lodash';
|
||
|
|
||
|
describe('rest', () => {
|
||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||
|
function fn(_a: unknown, _b: unknown, _c: unknown) {
|
||
|
// eslint-disable-next-line prefer-rest-params
|
||
|
return Array.from(arguments);
|
||
|
}
|
||
|
|
||
|
bench('es-toolkit/rest', () => {
|
||
|
restToolkit(fn, 1);
|
||
|
});
|
||
|
|
||
|
bench('es-toolkit/compat/rest', () => {
|
||
|
restCompat(fn, 1);
|
||
|
});
|
||
|
|
||
|
bench('lodash/rest', () => {
|
||
|
restLodash(fn, 1);
|
||
|
});
|
||
|
});
|