Methods
Protected _checkPrefix
- _checkPrefix(prefix: string): object
-
Parameters
Returns object
Protected _key
- _key(word: string): string
-
Parameters
Returns string
addWord
- addWord(word: string, value?: T): this
-
Parameters
-
word: string
-
Default value value: T = null
Returns this
countPrefix
- countPrefix(strPrefix: string): number
-
Parameters
Returns number
Number
dump
- dump(spacer?: string | number): string
-
Parameters
-
Default value spacer: string | number = 0
Returns string
getAnagrams
- getAnagrams(letters: string): string[]
-
Parameters
Returns string[]
Array
getPrefix
- getPrefix(strPrefix: string, sorted?: boolean): string[]
-
Parameters
-
strPrefix: string
-
Default value sorted: boolean = true
Returns string[]
Array
getRandomWordWithPrefix
- getRandomWordWithPrefix(strPrefix?: string): string
-
Parameters
-
Optional strPrefix: string
Returns string
String
getSubAnagrams
- getSubAnagrams(letters: string): string[]
-
Parameters
Returns string[]
Array
getWordData
- getWordData(word: string, notChkDefault?: boolean): object
- getWordData<R>(word: string, notChkDefault?: boolean): object
-
Parameters
-
word: string
-
Optional notChkDefault: boolean
Returns object
-
key: string
-
matched: boolean
-
value: T
-
Type parameters
Parameters
-
word: string
-
Optional notChkDefault: boolean
Returns object
-
key: string
-
matched: boolean
-
value: R
getWordNode
-
Parameters
-
Type parameters
Parameters
getWordNodeKeys
- getWordNodeKeys(word: string): string[]
-
Parameters
Returns string[]
getWordsAll
- getWordsAll(sorted?: boolean): string[]
-
Parameters
-
Default value sorted: boolean = true
Returns string[]
Array
hasWord
- hasWord(word: string): boolean
-
Parameters
Returns boolean
Boolean
Protected isAnagrams
- isAnagrams(letters: string): boolean
-
Parameters
Returns boolean
isPrefix
- isPrefix(prefix: string): boolean
-
Parameters
Returns boolean
Boolean
load
- load(obj: ITrieRaw<T>): this
- load<R>(obj: ITrieRaw<R>): this
- load(obj: any): this
-
Parameters
Returns this
-
Type parameters
Parameters
Returns this
-
Parameters
Returns this
removeWord
- removeWord(word: string, all?: boolean): this
-
Parameters
-
word: string
-
Optional all: boolean
Returns this
toRegExp
- toRegExp<R>(flags?: string, options?: ITrieToRegExpOptions): R
- toRegExp<R>(flags?: string, options?: ITrieToRegExpOptionsAll<R>): ReturnType<any>
-
Type parameters
Parameters
-
Optional flags: string
-
Optional options: ITrieToRegExpOptions
Returns R
-
Type parameters
Parameters
-
Optional flags: string
-
Optional options: ITrieToRegExpOptionsAll<R>
Returns ReturnType<any>
Add a new word to the trie