maputil
v1.0.0
Published
Simple ES6 Map utilities.
Downloads
4
Readme
Some utilities for Map
. So far, there are very few. Please open
issues with rationale to propose new additions.
getOrSet(map, key, createValue)
If key
exists in map
, return the value. Otherwise, set it to the
value returned by createValue()
and return the newly added value.
The ES6 Map
[does not provide a DRY way to get or set a
value. This function
does that.