Skip to main content

Function: flattenConcur()

flattenConcur<Value>(concurIterable): ConcurIterable<Value>

Returns a concur iterable that contains the values of each iterable in concurIterable.

Like Array.prototype.flat, but for concur iterables.

Unlike concat and concatAsync, this function does not necessarily iterate over each iterable in sequence.

Type Parameters

Value

Parameters

concurIterable: ConcurIterable<Iterable<Value, any, any> | AsyncIterable<Value, any, any> | ConcurIterable<Value>>

Returns

ConcurIterable<Value>

Example

console.log(
await pipe(
asConcur([asConcur([1, 2]), [3, `sloth`, 5], asAsync([6, 7])]),
flattenConcur,
reduceConcur(toArray()),
),
)
//=> [ 1, 2, 3, 'sloth', 5, 6, 7 ]

Defined in

transforms.d.ts:262