superhash
v1.1.1
Published
HashMap that supports using one or more keys of any type.
Downloads
117
Maintainers
Readme
SuperHash
HashMap that supports using one or more keys of any type*
Hash keys are generated using multikey-hash
Installation
$ npm install superhash
Examples
var SuperHash = require('superhash');
var hashMap = new SuperHash();
var data = 'value';
Single key:
hashMap.set(/.*/g, data);
hashMap.get("/.*/g"); // returns undefined
hashMap.get(/.*/g); // returns 'value'
hashMap.delete(/.*/g); // returns true
Multiple keys:
hashMap.set(1,{ name: 'foo' }, true, data);
hashMap.get(1,{ name: 'foo' }, "true"); // returns undefined
hashMap.get(1,{ name: 'foo' }, true); // returns 'value'
hashMap.delete(1,{ name: 'foo' }, true); // returns true
API
FAQ
What types of keys can be used?
Any primitive or mutable object can be used as a key.