Methods
get(key, defaultSupplieropt) → {*|null}
Returns the value to which the specified key is mapped.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | the key whose associated value is to be returned |
|
defaultSupplier |
function |
<optional> |
if the specified key is not already associated with a value, this function will return a default value |
Returns:
the current object for the supplied key, a default value if defaultSupplier is provided, or null
- Type
- * | null
put(key, value) → {*|null}
Associates the specified value with the specified key.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | key with which the specified value is to be associated |
value |
* | value to be associated with the specified key |
Returns:
the previous value associated with the key, or null if there was no mapping for key
- Type
- * | null
remove(key) → {*|null}
Removes the mapping for a key from this map if it is present.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | key whose mapping is to be removed from the cache |
Returns:
the previous value associated with the key or null if there was no mapping for key
- Type
- * | null
exists(key) → {boolean}
Checks the mapping for a key from this map.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | key whose mapping is to be checked in the map |
Returns:
whether the key has a mapping
- Type
- boolean