mirror of
https://github.com/toss/es-toolkit.git
synced 2025-01-06 07:57:12 +03:00
test(uniqWith): Add test cases for uniqWith (#36)
* fix(uniqWith): Add test cases for uniqWith * Update src/array/uniqWith.spec.ts * Update src/array/uniqWith.spec.ts --------- Co-authored-by: Sojin Park <raon0211@gmail.com>
This commit is contained in:
parent
79ce446a51
commit
dd5699631c
@ -12,5 +12,8 @@ describe('uniqWith', () => {
|
||||
(a, b) => a.x === b.x
|
||||
)
|
||||
).toEqual([{ x: 1, y: 2 }]);
|
||||
expect(uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1)).toEqual([
|
||||
1.2, 3.2, 5.7, 7.19,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
@ -10,7 +10,7 @@
|
||||
* @example
|
||||
* ```ts
|
||||
* uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);
|
||||
* // [1, 2, 3, 5, 7]
|
||||
* // [1.2, 3.2, 5.7, 7.19]
|
||||
* ```
|
||||
*/
|
||||
export function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {
|
||||
|
Loading…
Reference in New Issue
Block a user