A multi key dictionay
This is a node.js lib which provides a dictionary which can have multiple keys.
npm install multi-key-dictionary
Create a new object
var Dict = require'multi-key-dictionary';var dict = ;
Add values to the dictionary object. The keys can be passed as arguments or as an array.
NOTE The key parameter - ['a', 'b', 'c'] and ['a','c','b'] would represent two different keys and will store two different values. The order of keys is thus important.
//Passing keys as arguments.dictadd'a''b''c'34;//Pass keys as an array.dictadd'a''x''y'45;
In both cases the last parameter is considered as the value of the key.
Getting/Deleting the value using the get method. Here also the keys can be passed as arguments or as an array.
var x = dictget'a''b''c'; // returns 34dictremove'a''b''c';
A JS object is created to maintain the dictionary, which can be accessed by the items property of the dictionary.
console.logdictitems;//Will return the complete dictionary.