mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
16 lines
422 B
TypeScript
16 lines
422 B
TypeScript
|
import { bench, describe } from 'vitest';
|
||
|
import { sumBy as sumByToolkit } from 'es-toolkit';
|
||
|
import { sumBy as sumByLodash } from 'lodash';
|
||
|
|
||
|
describe('sumBy', () => {
|
||
|
bench('es-toolkit/sumBy', () => {
|
||
|
const items = [{ a: 1 }, { a: 2 }, { a: 3 }];
|
||
|
sumByToolkit(items, x => x.a);
|
||
|
});
|
||
|
|
||
|
bench('lodash/sumBy', () => {
|
||
|
const items = [{ a: 1 }, { a: 2 }, { a: 3 }];
|
||
|
sumByLodash(items, x => x.a);
|
||
|
});
|
||
|
});
|