Function pairwise

  • Return a new iterator of pairs (tuples) of the values in the input one. The number of pairs will always be one fewer than the input. Will be empty if the input has fewer than two values.

    Type Parameters

    • T

    Parameters

    Returns IterableIterator<[T, T]>

    iter([1,2,3]).pairwise().toArray() // [[1,2], [2,3]]
    iter([1]).pairwise().toArray() // []