|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
773 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Returns a new array containing only the unique elements from the original array,
|
|---|
| 3 | * based on the values returned by the comparator function.
|
|---|
| 4 | *
|
|---|
| 5 | * @template T - The type of elements in the array.
|
|---|
| 6 | * @param {T[]} arr - The array to process.
|
|---|
| 7 | * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.
|
|---|
| 8 | * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.
|
|---|
| 9 | *
|
|---|
| 10 | * @example
|
|---|
| 11 | * ```ts
|
|---|
| 12 | * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);
|
|---|
| 13 | * // [1.2, 3.2, 5.7, 7.19]
|
|---|
| 14 | * ```
|
|---|
| 15 | */
|
|---|
| 16 | declare function uniqWith<T>(arr: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[];
|
|---|
| 17 |
|
|---|
| 18 | export { uniqWith };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.