Function accumulate

  • Make an iterator that returns accumulated sums, or accumulated results of other binary functions (specified via the optional func argument).


    A sequence of accumulated values

    Type Parameters

    • T


    • iterable: Iterable<T>

      The iterable to accumulate

    • func: ((x: any, y: any) => any) = add

      The accumulator function (default add).

        • (x: any, y: any): any
        • The addition (+) operator. If x is an object with an add method, it returns x.add(y). Otherwise it returns the result of x + y.


          x + y


          • x: any
          • y: any

          Returns any

    • Optional initial: any

      Optional initial value (defaults to the first element in iterable)

    Returns Generator<any, void, unknown>

Generated using TypeDoc