dsherret / lookups

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

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

License:MIT License


Languages

Language:JavaScript 100.0%