lookups

1.0.1 • Public • Published

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.

Package Sidebar

Install

npm i lookups

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • mikkoh