ordered-dict
v0.0.1
Published
An ordered traversable dictionary with mutable ordering (from meteor.js)
Downloads
13
Readme
ordered-dict
An ordered traversable dictionary with mutable ordering (from meteor.js). It is implemented as a dictionary that contains nodes of a doubly linked list as its values.
Installation
npm install ordered-dict
Usage
var OrderedDict = require('ordered-dict');
var dict = new OrderedDict();
dict.append('a', '1');
dict.append('b', '2');
dict.putBefore('c', '3', 'b');
assert(dict.first() === 'a');
assert(dict.next('a') === 'c');
assert(dict.next('c') === 'b');
assert(dict.get('a') === '1');
assert(dict.get('c') === '3');
assert(dict.get('b') === '2');
Contributing
To get a new copy of the code, run node build.js
.
License
MIT