Function reduceMapAsync

Execute an asynchronous reducer function on each element of the source map, resulting in a single output value. Note that this does not parallelize asynchronous reduce steps so it should be used with caution.

  • Type Parameters

    • K
    • V
    • A

    Parameters

    • map: ReadonlyMap<K, V>

      source map

    • reducer: ((accumulator: A, value: V, key: K) => Promise<A>)

      asynchronous reducer function that takes an accumulated value, current iteration value, and current iteration key and returns a new accumulated value

        • (accumulator, value, key): Promise<A>
        • Parameters

          • accumulator: A
          • value: V
          • key: K

          Returns Promise<A>

    • initialValue: A

      initial accumulated value

    Returns Promise<A>