trie-obj

1.0.1 • Public • Published

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

Dependents (0)

Package Sidebar

Install

npm i trie-obj

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.5 kB

Total Files

6

Last publish

Collaborators

  • tenaciousmv