开发者社区> 镜像站> NPM> mapobject
mapobject
use a map, like an object
Last updated 6 years ago by cwmma .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mapobject 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.3                                ...           latest (6 years ago)

2 Versions

  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (1)
Dependents (1)