Skip to content

markEndsAsync

markEndsAsync<T>(iterable): AsyncIterableIterator<MarkedEnd<T>>

Defined in: packages/core/src/iterable/async/mark-ends.ts:19

Yields each element tagged with whether it is the first and whether it is the last.

The async counterpart of markEnds. Knowing an element is the last one requires a one-element lookahead, so the source always runs one step ahead of what has been yielded — on a slow stream that means one extra pending read at all times.

Time complexity: O(1) per element, allocating one tuple per yield.

T

MaybeAsyncIterable<T>

The input iterable, sync or async.

AsyncIterableIterator<MarkedEnd<T>>

An iterator over the tagged elements.