|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
589 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Creates a duplicate-free version of an array.
|
|---|
| 3 | *
|
|---|
| 4 | * This function takes an array and returns a new array containing only the unique values
|
|---|
| 5 | * from the original array, preserving the order of first occurrence.
|
|---|
| 6 | *
|
|---|
| 7 | * @template T - The type of elements in the array.
|
|---|
| 8 | * @param {T[]} arr - The array to process.
|
|---|
| 9 | * @returns {T[]} A new array with only unique values from the original array.
|
|---|
| 10 | *
|
|---|
| 11 | * @example
|
|---|
| 12 | * const array = [1, 2, 2, 3, 4, 4, 5];
|
|---|
| 13 | * const result = uniq(array);
|
|---|
| 14 | * // result will be [1, 2, 3, 4, 5]
|
|---|
| 15 | */
|
|---|
| 16 | declare function uniq<T>(arr: readonly T[]): T[];
|
|---|
| 17 |
|
|---|
| 18 | export { uniq };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.