@epikodelabs/streamix / concatMap
Function: concatMap()
concatMap<
T,R>(project):Operator<T,R>
Defined in: projects/libraries/streamix/src/lib/operators/concatMap.ts:24
Creates a stream operator that maps each value from the source stream to a new inner stream (or value/array/promise) and flattens all inner streams sequentially.
For each value from the source:
- The
projectfunction is called with the value and its index. - The returned value is normalized into a stream using fromAny.
- The inner stream is consumed fully before processing the next outer value.
This ensures that all emitted values maintain their original sequential order.
Type Parameters
T
T = any
The type of values in the source stream.
R
R = T
The type of values emitted by the inner streams and the output.
Parameters
project
(value, index) => Stream<R> | MaybePromise<R> | R[]
A function that takes a value from the source stream and its index, and returns either:
Returns
Operator<T, R>
An Operator instance that can be used in a stream's pipe method.