• Similar to the Array.prototype.reduce function, but for an iterable. See the documentation of the above function for more details. The first element will be used as the initial value.

    Type Parameters

    • TIn

    Parameters

    • iterable: Iterable<TIn>

      Iterable of which to reduce the elements.

    • callbackFn: ((previousValue: TIn, currentValue: TIn, currentIndex: number) => TIn)

      A reducer function.

        • (previousValue: TIn, currentValue: TIn, currentIndex: number): TIn
        • Parameters

          • previousValue: TIn
          • currentValue: TIn
          • currentIndex: number

          Returns TIn

    Returns TIn

  • Similar to the Array.prototype.reduce function, but for an iterable. See the documentation of the above function for more details.

    Type Parameters

    • TIn

    • TOut

    Parameters

    • iterable: Iterable<TIn>

      Iterable of which to reduce the elements.

    • callbackFn: ((previousValue: TOut, currentValue: TIn, currentIndex: number) => TOut)

      A reducer function.

        • (previousValue: TOut, currentValue: TIn, currentIndex: number): TOut
        • Parameters

          • previousValue: TOut
          • currentValue: TIn
          • currentIndex: number

          Returns TOut

    • initialValue: TOut

      The value to start from.

    Returns TOut