mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-04 20:42:18 +03:00
860fb0c0e2
* feat(minBy): Add minBy function that return minimum of arrary * feat(minBy): Add minBy bench test & export it * feat(minBy): Add documents of minBy * feat(minBy): Add unit test of minBy * Update src/math/minBy.ts --------- Co-authored-by: Sojin Park <raon0211@gmail.com> Co-authored-by: Sojin Park <raon0211@toss.im>
24 lines
598 B
TypeScript
24 lines
598 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { minBy as minByToolkit } from 'es-toolkit';
|
|
import { minBy as minByLodash } from 'lodash';
|
|
|
|
describe('minBy', () => {
|
|
bench('es-toolkit', () => {
|
|
const people = [
|
|
{ name: 'Mark', age: 30 },
|
|
{ name: 'Nunu', age: 20 },
|
|
{ name: 'Overmars', age: 35 },
|
|
];
|
|
minByToolkit(people, person => person.age);
|
|
});
|
|
|
|
bench('lodash', () => {
|
|
const people = [
|
|
{ name: 'Mark', age: 30 },
|
|
{ name: 'Nunu', age: 20 },
|
|
{ name: 'Overmars', age: 35 },
|
|
];
|
|
minByLodash(people, person => person.age);
|
|
});
|
|
});
|