Function reduce

  • Applies an accumulator function over an iterable sequence, returning the result of the aggregation as a single element in the result sequence. The seed value, if specified, is used as the initial accumulator value. For aggregation behavior with incremental intermediate results, scan.

    Type Parameters

    • T

      The type of the elements in the source sequence.

    • R = T

      The type of the result of the aggregation.

    Parameters

    • source: Iterable<T>

      An iterable sequence to aggregate over.

    • options: ReduceOptions<T, R>

      The options which contains a callback and optional seed.

    Returns R

    The final accumulator value.

  • Type Parameters

    • T

    • R = T

    Parameters

    • source: Iterable<T>
    • accumulator: ((accumulator, current, index) => R)
        • (accumulator, current, index): R
        • Parameters

          • accumulator: R
          • current: T
          • index: number

          Returns R

    • Optional seed: R

    Returns R

Generated using TypeDoc