1.0.1 • Published 6 years ago

trie-obj v1.0.1

Weekly downloads
3
License
MIT
Repository
-
Last release
6 years ago

trie-obj

a fun to use implementation of the trie data structure

not optimized for common suffixes, etc. Feel free to submit PRs

Usage

const Trie = require('trie-obj')
const trie = Trie.create()
// set key->value mappings as you would on a regular object
trie.hello = 'world'
trie.helicon = 'another world'
// lookup by prefix
console.log(trie.he)
// ['world', 'another world']

console.log(trie.hello)
// ['world']

// delete as you would from a regular object
delete trie.helicon
console.log(trie.he)
// ['world']