|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
923 bytes
|
| Line | |
|---|
| 1 | import { ExtractNestedArrayType } from './flattenDeep.mjs';
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * Recursively maps each element in an array using a provided iteratee function and then deeply flattens the resulting array.
|
|---|
| 5 | *
|
|---|
| 6 | * @template T - The type of elements within the array.
|
|---|
| 7 | * @template U - The type of elements within the returned array from the iteratee function.
|
|---|
| 8 | * @param {T[]} arr - The array to flatten.
|
|---|
| 9 | * @param {(item: T, index: number, array: readonly T[]) => U} iteratee - The function that produces the new array elements. It receives the element, its index, and the array.
|
|---|
| 10 | * @returns {Array<ExtractNestedArrayType<U>>} A new array that has been flattened.
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * const result = flatMapDeep([1, 2, 3], n => [[n, n]]);
|
|---|
| 14 | * // [1, 1, 2, 2, 3, 3]
|
|---|
| 15 | */
|
|---|
| 16 | declare function flatMapDeep<T, U>(arr: readonly T[], iteratee: (item: T, index: number, array: readonly T[]) => U): Array<ExtractNestedArrayType<U>>;
|
|---|
| 17 |
|
|---|
| 18 | export { flatMapDeep };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.