|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
436 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | /**
|
|---|
| 2 | * Flattens array up to depth times.
|
|---|
| 3 | *
|
|---|
| 4 | * @template T
|
|---|
| 5 | * @param {ArrayLike<T> | null | undefined} value - The array to flatten.
|
|---|
| 6 | * @param {number} depth - The maximum recursion depth.
|
|---|
| 7 | * @returns {any[]} Returns the new flattened array.
|
|---|
| 8 | *
|
|---|
| 9 | * @example
|
|---|
| 10 | * flatten([1, [2, [3, [4]], 5]], 2);
|
|---|
| 11 | * // => [1, 2, 3, [4], 5]
|
|---|
| 12 | */
|
|---|
| 13 | declare function flatten<T>(value: ArrayLike<T | readonly T[]> | null | undefined): T[];
|
|---|
| 14 |
|
|---|
| 15 | export { flatten };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.