A mutable map.
It is a wrapper around the in-built Map type, but adds roughly the same API as IMapImmutable.
Type of map keys. Typically string
string
Type of stored values
Adds one or more items to map
Can add items in the form of [key,value] or {key, value}.
{key, value}
Rest
map.set(`hello`, `samantha`);map.add([`hello`, `samantha`]);map.add({key: `hello`, value: `samantha`}) Copy
map.set(`hello`, `samantha`);map.add([`hello`, `samantha`]);map.add({key: `hello`, value: `samantha`})
Clears map
Deletes an item by key
Iterates over entries (consisting of [key,value])
for (const [key, value] of map.entries()) { // Use key, value...} Copy
for (const [key, value] of map.entries()) { // Use key, value...}
Gets an item by key
const item = map.get(`hello`); Copy
const item = map.get(`hello`);
Returns true if map contains key
if (map.has(`hello`)) ... Copy
if (map.has(`hello`)) ...
Returns true if map is empty
Sets a value to a specified key
A mutable map.
It is a wrapper around the in-built Map type, but adds roughly the same API as IMapImmutable.