CCC Docs
    Preparing search index...

    Function reduceAsync

    Similar to Array.reduce, but works on async iterables and the accumulator can return a Promise.

    The value, iterable, or async iterable to be reduced.

    A callback to be called for each value. If it returns null or undefined, the previous result will be kept.

    The initial value.

    The accumulated result.

    • Similar to Array.reduce, but works on async iterables and the accumulator can return a Promise.

      Type Parameters

      • T

      Parameters

      • values: T | Iterable<T, any, any> | AsyncIterable<T, any, any>

        The value, iterable, or async iterable to be reduced.

      • accumulator: (
            a: T,
            b: T,
            i: number,
        ) => void | T | Promise<void | T | null | undefined> | null | undefined

        A callback to be called for each value. If it returns null or undefined, the previous result will be kept.

      Returns Promise<T>

      The accumulated result.

    • Similar to Array.reduce, but works on async iterables and the accumulator can return a Promise.

      Type Parameters

      • T
      • V

      Parameters

      • values: V | Iterable<V, any, any> | AsyncIterable<V, any, any>

        The value, iterable, or async iterable to be reduced.

      • accumulator: (
            a: T,
            b: V,
            i: number,
        ) => void | T | Promise<void | T | null | undefined> | null | undefined

        A callback to be called for each value. If it returns null or undefined, the previous result will be kept.

      • init: T | Promise<T>

        The initial value.

      Returns Promise<T>

      The accumulated result.