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 ]

flatMapConcur(fn)

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

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.

Type Parameters

From

To

Parameters

fn

Returns

Function

Parameters

concurIterable: ConcurIterable<From>

Returns

ConcurIterable<To>

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 ]

Defined in

transforms.d.ts:174

flatMapConcur(fn, concurIterable)

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

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.

Type Parameters

From

To

Parameters

fn

concurIterable: ConcurIterable<From>

Returns

ConcurIterable<To>

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 ]

Defined in

transforms.d.ts:181