1.0.1 • Published 1 year ago

trie-dict v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Trie Dictionary

Fast and memory efficient dictionary using Trie Structure.

Install

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install trie-dict
import TrieDict from "trie-dict";

const dict = TrieDict({ words: ["Trie", "dictionary"], caseSensitive: fasle });;

The options object

words

- default: `[]`
- type: `string[]`

The initial words to add the Trie.

caseSensitive

- default: `true`
- type: `boolean`

Case sensitive dictionary.

API

dict.add(word: string)

Add new word to the dictionary.

dict.has(word: string): boolean

Check if word exist in the dictionary.

dict.remove(word: string): boolean

Remove the word from the dictionary if it exist.

dict.startsWith(initial: string): boolean

Check if the dictionary has any word that starts with initial.

1.0.1

1 year ago

1.0.0

1 year ago