> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# flatMapDeep (Functional Programming) es-toolkit

Creates a function that maps each value and deeply flattens the result. Use it with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

```typescript
const result = pipe(array, flatMapDeep(iteratee));
```

::: info

Prefer the original es-toolkit [`flatMapDeep`](https://massaman.dev/reference/array/flatMapDeep.md) in ordinary code. Use this `fp` variant when composing transformations with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

:::

## Usage

`flatMapDeep` calls `iteratee` for each value in the piped array and recursively flattens the returned arrays.

```typescript
import { flatMapDeep, pipe } from 'es-toolkit/fp';

pipe(
  [1, 2],
  flatMapDeep(value => [[value, value]])
); // => [1, 1, 2, 2]
```

#### Parameters


iteratee(item: T, index: number) => Urequired

The function that maps each value before deep flattening.

#### Returns

A function that maps a `readonly T[]` to a deeply flattened array.

```typescript
(array: readonly T[]) => Array<ExtractNestedArrayType<U>>
```


Source: es-toolkit

Re-exported verbatim from [`es-toolkit`](https://es-toolkit.dev/fp/reference/flatMapDeep.html). Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.
