Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anthonyshort/map
Simple map, similar to ES6 map
https://github.com/anthonyshort/map
Last synced: 24 days ago
JSON representation
Simple map, similar to ES6 map
- Host: GitHub
- URL: https://github.com/anthonyshort/map
- Owner: anthonyshort
- Created: 2012-12-04T09:41:05.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-16T10:07:00.000Z (over 11 years ago)
- Last Synced: 2024-04-15T03:16:20.335Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# map
Simple map, similar to ES6 map. Set and get values but it allows anything to be the key.
## Installation
$ component install anthonyshort/map
## API
var data = new Map();
// Use a DOM element as a key
var el = document.querySelector('#task-list');
data.set(el, {
'model': 'task',
'height': 200
});console.log(data.get(el).height); // 200
// Or use as a simple key/value store
data.set('foo', 'bar');// Iterate over them
data.forEach(function(value, key){});
// Set initial data
var moreData = new Map(['key', 'value'], ['key2', 'value']);
console.log(moreData.get('key')); // 'value'## License
MIT