Skip to main content

Function: flatMapConcur()

Returns an concur iterable containing the values of the concur iterables returned, or resolving from promises returned, from applying fn to each value of concurIterable.

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

Example

console.log(
await pipe(
asConcur([`sloth`, `more sloth`, `even more sloth`]),
flatMapConcur(string => [string, string.length]),
reduceConcur(toArray()),
),
)
//=> [ 'sloth', 5, 'more sloth', 10, 'even more sloth', 15 ]

Since

v0.0.1

Call Signature

flatMapConcur<From, To>(fn): (concurIterable) => ConcurIterable<To>

Type Parameters

From

To extends [] | unknown[]

Parameters

fn

(value) => MaybePromiseLike<ConcurIterable<To> | Iterable<To, any, any> | AsyncIterable<To, any, any>>

Returns

Function

Parameters

concurIterable

ConcurIterable<From>

Returns

ConcurIterable<To>

Defined in

transforms.d.ts:226

Call Signature

flatMapConcur<From, To>(fn, concurIterable): ConcurIterable<To>

Type Parameters

From

To extends [] | unknown[]

Parameters

fn

(value) => MaybePromiseLike<ConcurIterable<To> | Iterable<To, any, any> | AsyncIterable<To, any, any>>

concurIterable

ConcurIterable<From>

Returns

ConcurIterable<To>

Defined in

transforms.d.ts:233

Call Signature

flatMapConcur<From, To>(fn): (concurIterable) => ConcurIterable<To>

Type Parameters

From

To

Parameters

fn

(value) => MaybePromiseLike<ConcurIterable<To> | Iterable<To, any, any> | AsyncIterable<To, any, any>>

Returns

Function

Parameters

concurIterable

ConcurIterable<From>

Returns

ConcurIterable<To>

Defined in

transforms.d.ts:242

Call Signature

flatMapConcur<From, To>(fn, concurIterable): ConcurIterable<To>

Type Parameters

From

To

Parameters

fn

(value) => MaybePromiseLike<ConcurIterable<To> | Iterable<To, any, any> | AsyncIterable<To, any, any>>

concurIterable

ConcurIterable<From>

Returns

ConcurIterable<To>

Defined in

transforms.d.ts:249