• The equivalent of Array.prototype.reduce for iterators.

    Type Parameters

    • T
    • U

    Parameters

    • iterable: Iterable<T, any, any>

      The iterator to reduce.

    • f: ((previous: U, current: T, index?: number) => U)

      The reducer function.

        • (previous, current, index?): U
        • Parameters

          • previous: U
          • current: T
          • Optionalindex: number

          Returns U

    • initial: U

      The initial value to use for reduction.

    Returns U