Files
cannaiq/frontend/node_modules/es-toolkit/dist/array/flatMapDeep.d.mts
2025-11-28 19:45:44 -07:00

19 lines
800 B
TypeScript

import { ExtractNestedArrayType } from './flattenDeep.mjs';
/**
* Recursively maps each element in an array using a provided iteratee function and then deeply flattens the resulting array.
*
* @template T - The type of elements within the array.
* @template U - The type of elements within the returned array from the iteratee function.
* @param {T[]} arr - The array to flatten.
* @param {(item: T) => U} iteratee - The function that produces the new array elements.
* @returns {Array<ExtractNestedArrayType<U>>} A new array that has been flattened.
*
* @example
* const result = flatMapDeep([1, 2, 3], n => [[n, n]]);
* // [1, 1, 2, 2, 3, 3]
*/
declare function flatMapDeep<T, U>(arr: readonly T[], iteratee: (item: T) => U): Array<ExtractNestedArrayType<U>>;
export { flatMapDeep };