Skip to content

reduceWithKey

reduceWithKey<K, A, B>(init, f): (m) => B

Defined in: Utils/Dict.ts:428

Folds the dictionary into a single value by applying f to each key-value pair in insertion order.

K

A

B

B

(acc, value, key) => B

(m): B

ReadonlyMap<K, A>

B

Dict.reduceWithKey("", (acc, value, key) => acc + key + ":" + value + " ")(
  Dict.fromEntries([["a", 1], ["b", 2]])
); // "a:1 b:2 "