@types/trie-prefix-tree
TypeScript icon, indicating that this package has built-in type declarations

1.5.3 • Public • Published

Installation

npm install --save @types/trie-prefix-tree

Summary

This package contains type definitions for trie-prefix-tree (https://github.com/lyndseybrowning/trie-prefix#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/trie-prefix-tree.

index.d.ts

export default function Trie(
    strings: string[],
): {
    /**
     * Get a string representation of the trie
     */
    dump(spacer?: number): string;
    /**
     * Get the generated raw trie object
     */
    tree(): any;
    /**
     * Add a new word to the trie
     */
    addWord(word: string): ReturnType<typeof Trie>;
    /**
     * Remove an existing word from the trie
     */
    removeWord(word: string): ReturnType<typeof Trie>;
    /**
     * Check a prefix is valid
     * @returns Boolean
     */
    isPrefix(word: string): boolean;
    /**
     * Count the number of words with the given prefixSearch
     * @returns Number
     */
    countPrefix(word: string): number;
    /**
     * Get a list of all words in the trie with the given prefix
     * @returns Array
     */
    getPrefix(word: string, sort?: boolean): string[];
    /**
     * Get a random word in the trie with the given prefix
     * @returns Array
     */
    getRandomWordWithPrefix(prefix: string): string;
    /**
     * Get all words in the trie
     * @returns Array
     */
    getWords(sorted?: boolean): string[];
    /**
     * Check the existence of a word in the trie
     * @returns Boolean
     */
    hasWord(word: string): boolean;
    /**
     * Get a list of valid anagrams that can be made from the given letters
     * @returns Array
     */
    getAnagrams(word: string): string[];
    /**
     * Get a list of all sub-anagrams that can be made from the given letters
     * @returns Array
     */
    getSubAnagrams(word: string): string[];
};

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by James Lismore.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/trie-prefix-tree

Weekly Downloads

354

Version

1.5.3

License

MIT

Unpacked Size

5.72 kB

Total Files

5

Last publish

Collaborators

  • types