npm.io
1.0.6 • Published 8 years ago

ds-trie

Licence
MIT
Version
1.0.6
Deps
0
Size
7 kB
Vulns
0
Weekly
0
Stars
1

ds-trie

A dead-simple trie data structure for JavaScript

Usage:

const Trie = require('ds-trie');
const assert = require('assert');

const t = new Trie();

t.addElement(['path', 'a'], 'something');
t.addElements(['path', 'b'], ['other', 'stuff']);
t.removeElement(['path', 'b'], 'other');

t.addElement(['path'], 'root');

assert.deepStrictEqual(t.collect(['path', 'b']), ['stuff', 'root']);

Keywords