lookups
v1.0.1
Published
A datastructure which allows you to use any Javascript value as a key. Keys can be Objects, Functions, Numbers, Strings.
Downloads
4
Maintainers
Readme
lookups
A datastructure which allows you to use any Javascript value as a key. Keys can be Objects, Functions, Numbers, Strings.
Usage
Example:
var lookups = require( 'lookups' );
var keyObject = { 'something': 'someValue' };
var keyFunction = function() {};
var keyString = 'something';
var keyNumber = 123;
var keyFunction2 = function() {};
var collection = new lookups(
keyObject, true,
keyFunction, 123,
keyString, {},
keyNumber, 'hell world'
);
collection.set( keyFunction2, 'something new' ); // will return 'something new'
collection.get( keyObject ); // will return the object { 'something': 'someValue' }
collection.remove( keyString ); // will delete and return 'something'
License
MIT, see LICENSE.md for details.