Function pairs

  • Pairs the passed-in elements of the iterable. If the iterable has less than two values it returns empty.

    Type Parameters

    • Iter extends AnyIt<unknown>

    Parameters

    • iter: Iter

      A sync or async iterable.

    Returns CondIt<Iter, It<[AnyItV<Iter>, AnyItV<Iter>]>, AIt<[AnyItV<Iter>, AnyItV<Iter>]>>

    Returns an iterable whose values are lists of two elements.

    Example

    // Returns an iterable representing ['AB','BC','CD','DE','EF','FG']
    pairs('ABCDEFG')