Skip to content

calvinmetcalf/objectmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ObjectMap

Use an ES6 Map using object syntax, so

map = oMap();
//these are the same
map.set('abc',9);
map.abc = 9;
//as are these
map.get('abc');
map.abc;
//and these
map.delete('abc');
delete map.abc;

it should be noted that using it in the object style coerses everything to a string so

//these are not equivilent
map.set(3);
map[3];
//these are
map.set('3');
map[3];

you can also itererate it like a regular object (for in) and you will only get the keys from the map

lastly if you iterate it with the new iterator protocol (for of) you will get arrays of length 2 of both keys and values

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published