• Iterates over the elements of an Iterable in pairs.

    Remarks

    The behavior for pairSize < 1 is not defined.

    Example

    Iterate in pairs

    const iterable = [1, 2, 3];
    const pairIterable = pairwise()(iterable);
    console.log(pairIterable); // [[1,2], [2,3]]

    See

    chunk and zip for similar operations.

    Returns

    the tuple emitting Iterable

    Type Parameters

    • L extends number = 2

      the length of the tuple

    Parameters

    • pairSize: L = ...

      the optional length of the emitted tuples

    Returns (<T>(iterable: Iterable<T>, buffer?: T[]) => IterableIterator<Tuple<T, L>>)

Generated using TypeDoc