new DefaultMap(factory, iterableopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
factory |
function | Function that creates a new default value if a requested key is not present. |
|
iterable |
Iterable |
<optional> |
Passed to {Map} super(). |
Extends
- Map
Methods
-
get(key) → {object}
-
Parameters:
Name Type Description keyobject The key of the element to return from this instance.
Returns:
object -The value associated with the key, perhaps newly created.
-
getWithArguments(key, …args) → {object}
-
Variant of
Map.prototype.get()that passes args to the factory.Parameters:
Name Type Attributes Description keyobject The key of the element to return from this instance.
argsobject <repeatable>
Extra arguments passed to the factory function if it is called.
Returns:
object -The value associated with the key, perhaps newly created.