CCC Docs
    Preparing search index...

    Function reduceAsync

    Similar to Array.reduce, but the accumulator can returns Promise.

    The array to be reduced.

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

    The initial value.

    The accumulated result.

    • Similar to Array.reduce, but the accumulator can returns Promise.

      Type Parameters

      • T

      Parameters

      • values: T[]

        The array to be reduced.

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

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

      Returns Promise<T>

      The accumulated result.

    • Similar to Array.reduce, but the accumulator can returns Promise.

      Type Parameters

      • T
      • V

      Parameters

      • values: V[]

        The array to be reduced.

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

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

      • init: T | Promise<T>

        The initial value.

      Returns Promise<T>

      The accumulated result.