ds-trie

A dead-simple trie data structure


Keywords
trie
License
MIT
Install
npm install ds-trie@1.0.6

Documentation

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']);