pairwise
pairwise<
T>(iterable):IterableIterator<[T,T]>
Defined in: packages/core/src/iterable/pairwise.ts:15
Yields each consecutive overlapping pair of elements.
The size = 2 case of windowed, kept separate so the result is a [T, T]
tuple rather than a T[] a caller has to assert the width of.
An input of fewer than two elements yields nothing.
Time complexity: O(n), allocating one tuple per pair.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
Returns
Section titled “Returns”IterableIterator<[T, T]>
An iterator over the pairs, each holding an element and the one after it.