Function reduceMap

Execute a reducer function on each element of the source map, resulting in a single output value.

  • Type Parameters

    • K
    • V
    • A

    Parameters

    • map: ReadonlyMap<K, V>

      source map

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

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

        • (accumulator, value, key): A
        • Parameters

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

          Returns A

    • initialValue: A

      initial accumulated value

    Returns A