upsert
upsert<
K,V>(key,f): (m) =>ReadonlyMap<K,V>
Defined in: Utils/Dict.ts:224
Returns a new dictionary with the value at key set by f. If the key does not exist,
f receives None. If the key exists, f receives Some(currentValue).
Useful for incrementing counters, initialising defaults, or conditional updates.
Type Parameters
Section titled “Type Parameters”K
V
Parameters
Section titled “Parameters”K
(existing) => V
Returns
Section titled “Returns”(
m):ReadonlyMap<K,V>
Parameters
Section titled “Parameters”ReadonlyMap<K, V>
Returns
Section titled “Returns”ReadonlyMap<K, V>