Skip to main content

Function: indexConcur()

indexConcur<Value>(concurIterable): ConcurIterable<[number, Value]>

Returns a concur iterable equivalent to concurIterable except each value of concurIterable is placed in an entry containing the value's 0-based index in the iteration order followed by the value itself.

Type Parameters

Value

Parameters

concurIterable: ConcurIterable<Value>

Returns

ConcurIterable<[number, Value]>

Example

console.log(
await pipe(
asConcur([`sloth`, `more sloth`, `even more sloth`]),
indexConcur,
reduceConcur(toArray()),
),
)
//=> [ [ 0, 'sloth' ], [ 1, 'more sloth' ], [ 2, 'even more sloth' ] ]

Defined in

transforms.d.ts:333