The type of the keys in the Map.
map to get value from
key to get value for
callback to set the value if key is not present
The value retrieved from the Map or generated by the callback function.
const map = new Map<string, number>()
map.set('key', 1)
mapGetOrElse(map, 'nonexistentKey', () => 2) // Output: 2
Generated using TypeDoc
Returns a value from a map, while setting a given default value before returning it, if the key is not present.