Package Exports
- ds-trie
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ds-trie) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ds-trie
A dead-simple trie data structure for JavaScript
Usage:
const trie = require('ds-trie');
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(elementsEqual(t.collect(['path', 'b']), ['stuff', 'root']));
const elementsEqual = (xs, ys) => {
if (xs.length !== ys.length) return false;
for (let i = 0; i < xs.length; x++) {
if (xs[i] !== ys[i]) return false;
}
return true;
}