Function pairs

  • For each adjacent pair of elements in the specified array, returns a new array of tuples of elements i and i - 1. Returns the empty array if the input array has fewer than two elements.

    Type Parameters

    • T

    Parameters

    • iterable: Iterable<T>

      Array of input elements

    Returns [T, T][]

  • For each adjacent pair of elements in the specified array, in order, invokes the specified reducer function passing the element i and element i - 1. Returns the resulting array of pair-wise reduced elements. Returns the empty array if the input array has fewer than two elements.

    Type Parameters

    • T

    • U

    Parameters

    • iterable: Iterable<T>

      Array of input elements

    • reducer: ((a, b) => U)

      A reducer function taking as input to adjacent elements of the input array and returning a reduced value.

        • (a, b): U
        • Parameters

          • a: T
          • b: T

          Returns U

    Returns U[]