Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tlhunter/take-home-test-node-trie
Teaching a friend how to implement Tries in JS
https://github.com/tlhunter/take-home-test-node-trie
Last synced: about 1 month ago
JSON representation
Teaching a friend how to implement Tries in JS
- Host: GitHub
- URL: https://github.com/tlhunter/take-home-test-node-trie
- Owner: tlhunter
- Created: 2017-09-24T21:17:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-08T17:57:41.000Z (over 2 years ago)
- Last Synced: 2024-10-15T10:16:10.429Z (3 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js Trie
Note: Project is not available on NPM.
## Usage
```js
const Trie = require('trie.js'); // whereever you save trie.js
const words = new Trie();words.add('the');
words.add('their');
words.add('there');
words.add('orange');words.has('the') === true // Contains the word 'the'
words.has('ther') === false // Doesn't contain a word 'ther'
words.count('th') === 3 // Has three words that begin with 'th'
words.count() === 4 // Contains 4 words total
words.has('banana') === false // Does not contain 'banana'
```## Testing
Execute the following:
```sh
./test.js
```