0.0.5 • Published 3 years ago

typescript-trie v0.0.5

Weekly downloads
7
License
MIT
Repository
github
Last release
3 years ago

typescript-trie

WIP WARNING

This library is a work in process. It should function as a basic trie right now. More documentation, use examples, and test cases are added daily. I wouldn't advise using it in production but if you want to use it in a project and give feedback or improve the library please submit a PR. I especially appreciate suggested test cases! :D

Examples

Autocomplete (words only)

const t = new Trie()

Autocomplete (words and sentences)

const t = new Trie({delimiter: ' '})

Router

const t = new Trie('/')

In the case of empty string (or the case that the string contains only delimiters) the trie returns the root node or the empty string. In the case of a string that is parsed to be nothing but is not the empty string, it returns an error on insertion and null on find.

This trie implementation was extracted from Trie Spa Router which is also a WIP.