Returns an OperationFunction that maps each element to an Iterable and flattens the result.
Type of items in the source.
Type of items in the resulting Iterable.
Mapping function.
An OperationFunction that maps each element to an Iterable and flattens the result.
const result = flatMap<number, number>((value) => [value, value + 1])([1, 2, 3]);console.log([...result]); // [1, 2, 2, 3, 3, 4] Copy
const result = flatMap<number, number>((value) => [value, value + 1])([1, 2, 3]);console.log([...result]); // [1, 2, 2, 3, 3, 4]
Returns an OperationFunction that maps each element to an Iterable and flattens the result.