mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 03:34:26 +03:00
cf65b2c601
* chore: add prettierrc * chore: apply format with prettier config * chore: eslint error fix
20 lines
640 B
TypeScript
20 lines
640 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { unionWith as unionWithToolkit } from 'es-toolkit';
|
|
import { unionWith as unionWithLodash } from 'lodash';
|
|
|
|
describe('unionWith', () => {
|
|
bench('es-toolkit', () => {
|
|
const array1 = [{ id: 1 }, { id: 2 }];
|
|
const array2 = [{ id: 2 }, { id: 3 }];
|
|
const areItemsEqual = (a, b) => a.id === b.id;
|
|
unionWithToolkit(array1, array2, areItemsEqual);
|
|
});
|
|
|
|
bench('lodash', () => {
|
|
const array1 = [{ id: 1 }, { id: 2 }];
|
|
const array2 = [{ id: 2 }, { id: 3 }];
|
|
const areItemsEqual = (a, b) => a.id === b.id;
|
|
unionWithLodash(array1, array2, areItemsEqual);
|
|
});
|
|
});
|