Skip to content

pairwiseAsync

pairwiseAsync<T>(iterable): AsyncIterableIterator<[T, T]>

Defined in: packages/core/src/iterable/async/pairwise.ts:15

Yields each consecutive overlapping pair of elements.

The async counterpart of pairwise. An input of fewer than two elements yields nothing.

Time complexity: O(n), allocating one tuple per pair.

T

MaybeAsyncIterable<T>

The input iterable, sync or async.

AsyncIterableIterator<[T, T]>

An iterator over the pairs, each holding an element and the one after it.