Constructor
new Map()
A polyfill to provide Map.prototype.getOrInsert, Map.prototype.getOrInsertComputed, WeakMap.prototype.getOrInsert, and WeakMap.prototype.getOrInsertComputed methods.
Methods
mapGetOrInsert_(key, defaultValue) → {V}
Returns the value for the given key if present; otherwise inserts
the default value, and returns that.
This:
- (Map<K, V>|WeakMap<K, V>)
Parameters:
| Name | Type | Description |
|---|---|---|
key |
K | |
defaultValue |
V |
- Source:
Returns:
- Type
- V
mapGetOrInsertComputed_(key, callbackFunction) → {V}
Returns the value for the given key if present; otherwise calls
the callback with the key, inserts the returned value, and returns that.
This:
- (Map<K, V>|WeakMap<K, V>)
Parameters:
| Name | Type | Description |
|---|---|---|
key |
K | |
callbackFunction |
function(K): V |
- Source:
Returns:
- Type
- V