Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/trie-prefix-tree

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/trie-prefix-tree

TypeScript definitions for trie-prefix-tree

  • 1.5.4
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
339
decreased by-32.87%
Maintainers
1
Weekly downloads
 
Created
Source

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

type RawTree =
    & { "$"?: 1 | undefined }
    & { [s in Exclude<string, "$">]?: RawTree | undefined };

declare function Trie(
    strings: string[],
): {
    /**
     * Get a string representation of the trie
     */
    dump(spacer?: number): string;
    /**
     * Get the generated raw trie object
     */
    tree(): RawTree;
    /**
     * 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[];
};

export = Trie;

Additional Details

  • Last updated: Thu, 19 Sep 2024 17:36:27 GMT
  • Dependencies: none

Credits

These definitions were written by James Lismore.

FAQs

Package last updated on 19 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc