A Simple JavaScript Trie, by John Resig
Install
npm install --save resig-trie
Usage
var trie = ; trie;//=> <trie object> trie; // true to create valid JSON//=> '<trie object as JSON>' trie; // false to create valid JavaScript (not JSON) - more efficient, but must be `eval`'ed//=> '<trie object as long string>' // Warning: this uses eval(), so don't pass user input. When the trie is// serialized as JSON, you can just JSON.parse() it.trie;//=> <trie object> trie;//=> true, because 'banana' is in the trie trie;//=> false, because 'microsoft' is not in the trie
License
Copyright 2011 John Resig. Josh Oldenburg packaged this as a simple npm module in 2014.
Released under the MIT license.