0.0.1 • Published 10 years ago

ordered-dict v0.0.1

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

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.

Build Status Dependency Status NPM version

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