flatMapDeep es-toolkit
Transforms each element of an array with a function's return value, then flattens all depths and returns a new array.
Usage
flatMapDeep(arr, iteratee)
Use flatMapDeep when you want to transform an array while completely flattening all nested arrays. First, it applies a function to each element, then flattens the resulting array to all depths.
It flattens all depths no matter how deeply nested.
Parameters
The array to transform.
The function that transforms each array element. It receives the element, its index, and the array.
Returns
Returns a new array where each element is transformed and all depths are flattened.
Examples
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.