• Applies a callback function to each pair of elements in an array, and returns an array of the results.

    Return undefined in the callback function to exclude the entry.

    Type Parameters

    • T

      The type of the elements in the input array.

    • R

      The type of the elements in the resulting array.

    Parameters

    • items: T[]

      The input array.

    • cb: ((a, b, i, j, items) => undefined | R)

      The callback function to apply to each pair of elements. It takes two elements from the input array, their indices, and the entire input array as parameters, and returns the result of the computation, or undefined if no result is produced.

        • (a, b, i, j, items): undefined | R
        • Parameters

          • a: T
          • b: T
          • i: number
          • j: number
          • items: T[]

          Returns undefined | R

    Returns R[]

    An array of the results of applying the callback function to each pair of elements.

Generated using TypeDoc