• Efficiently search for a large number of strings using a prefix-tree. The longest match is returned.

    Parameters

    • nodes: Node[]
    • prefixes: string | string[] | {
          addWord(word): { dump(spacer?: number | undefined): string; tree(): any; addWord(word: string): ...; removeWord(word: string): ...; isPrefix(word: string): boolean; countPrefix(word: string): number; ... 5 more ...; getSubAnagrams(word: string): string[]; };
          countPrefix(word): number;
          dump(spacer?): string;
          getAnagrams(word): string[];
          getPrefix(word, sort?): string[];
          getRandomWordWithPrefix(prefix): string;
          getSubAnagrams(word): string[];
          getWords(sorted?): string[];
          hasWord(word): boolean;
          isPrefix(word): boolean;
          removeWord(word): { dump(spacer?: number | undefined): string; tree(): any; addWord(word: string): ...; removeWord(word: string): ...; isPrefix(word: string): boolean; countPrefix(word: string): number; ... 5 more ...; getSubAnagrams(word: string): string[]; };
          tree(): any;
      }
    • Optional options: {
          assumeOneCharStrings?: boolean;
          matchSubstrings?: boolean;
          startIndex?: number;
      }
      • Optional assumeOneCharStrings?: boolean

        assume that all strings are one character long (for example, like they are in math mode)

      • Optional matchSubstrings?: boolean

        whether to allow matching only part of a substring.

      • Optional startIndex?: number

        the index to start scanning at. Defaults to 0.

    Returns {
        endNodeIndex: number;
        endNodePartialMatch: string | null;
        match: string;
    } | null

Generated using TypeDoc