1.0.1 • Published 10 years ago

lookups v1.0.1

Weekly downloads
8
License
MIT
Repository
github
Last release
10 years ago

lookups

experimental

A datastructure which allows you to use any Javascript value as a key. Keys can be Objects, Functions, Numbers, Strings.

Usage

NPM

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.