Skip to content

Function.flatMap

github-actions[bot] edited this page Nov 18, 2026 · 4 revisions

umt / flatMap

Function: flatMap()

flatMap<T, U>(function_): (array) => U[]

Defined in: Pipe/flatMap.ts:9

Creates a pipe operator that maps each array element and flattens the result by one level

Type Parameters

T

T

U

U

Parameters

function_

(value, index) => U | readonly U[]

The function that returns a value or an array for each element

Returns

An operator that returns the flattened array

(array) => U[]

Example

pipe([1, 2], flatMap((x) => [x, x * 10])); // [1, 10, 2, 20]

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally