Skip to content

fx-flow v0.7.0 / pipe/lazy / enumerate

Function: enumerate()

enumerate(iterable)

enumerate<A>(iterable): IterableIterator<[number, A]>

Returns Iterable/AsyncIterable of values with index.

Type parameters

A

Parameters

iterable: Iterable<A>

Returns

IterableIterator<[number, A]>

Example

typescript
pipe(
 [1, 2],
 enumerate,
 toArray,
); // [[0, 1], [1, 2]]

More examples

Source

packages/core/src/pipe/lazy/enumerate.ts:66

enumerate(iterable)

enumerate<A>(iterable): AsyncIterableIterator<[number, A]>

Type parameters

A

Parameters

iterable: AsyncIterable<A>

Returns

AsyncIterableIterator<[number, A]>

Source

packages/core/src/pipe/lazy/enumerate.ts:67

enumerate()

enumerate<A>(): (iterable) => IteratorReturnValue<A, [number, UniversalIterableItem<A>]>

Type parameters

A extends UniversalIterable

Returns

Function

Parameters

iterable: A

Returns

IteratorReturnValue<A, [number, UniversalIterableItem<A>]>

Source

packages/core/src/pipe/lazy/enumerate.ts:68

Released under the MIT License.