/** @packageDocumentation * @module Utilities */ /** Interface that returns indices of matches * @public */ export interface IMatch { start: number; end: number; } /** * IFilter defines filter function type * @param word filter string * @param wordToMatchAgainst string to search for matches * @internal */ export declare type IFilter = (word: string, wordToMatchAgainst: string) => IMatch[] | null; /** * @returns A filter which combines the provided set * of filters with an or. The *first* filters that * matches defined the return value of the returned * filter. * @internal */ export declare function or(...filter: IFilter[]): IFilter; /** @internal */ export declare const matchesStrictPrefix: IFilter; /** @internal */ export declare const matchesPrefix: IFilter; /** @internal */ export declare function matchesContiguousSubString(word: string, wordToMatchAgainst: string): IMatch[] | null; /** * Return case insensitive substring matches * @param word filter string * @param wordToMatchAgainst string to test * @internal */ export declare function matchesSubString(word: string, wordToMatchAgainst: string): IMatch[] | null; /** * Return matches treating "camelCase" words separately. For example the filter string "gp" would return two matches in string "Git Pull". * @param word filter string * @param wordToMatchAgainst string to test * @internal */ export declare function matchesCamelCase(word: string, camelCaseWord: string): IMatch[] | null; /** * Matches beginning of words supporting non-ASCII languages. * @param word Filter string * @param target String being searched * @param contiguous - If true the filter string must be found "contiguous" in the searched string (E.g. "pul" will match "Git: Pull"). * Otherwise also matches sub string of the word with beginnings of the words in the target (e.g. "gp" or "g p" will match "Git: Pull"). * Useful in cases where the target is words (e.g. command labels) * @internal */ export declare function matchesWords(word: string, target: string, contiguous?: boolean): IMatch[] | null; /** * Match pattern against word in a fuzzy way. This will only return a single match. * @internal */ export declare function matchesFuzzy(word: string, wordToMatchAgainst: string, enableSeparateSubstringMatching?: boolean): IMatch[] | null; /** * Match pattern against word in a fuzzy way. As in IntelliSense and faster and more * powerful than `matchesFuzzy`. This will only return a single match. * @internal */ export declare function matchesFuzzy2(pattern: string, word: string): IMatch[] | null; /** * @internal */ export declare function createMatches(score: undefined | FuzzyScore): IMatch[]; /** @internal */ export declare function isPatternInWord(patternLow: string, patternPos: number, patternLen: number, wordLow: string, wordPos: number, wordLen: number): boolean; /** * A tuple of three values. * 0. the score * 1. the matches encoded as bitmask (2^53) * 2. the offset at which matching started * @internal */ export declare type FuzzyScore = [number, number, number]; /** @internal */ export declare namespace FuzzyScore { /** * No matches and value `-100` * @internal */ const Default: [-100, 0, 0]; /** @internal */ function isDefault(score?: FuzzyScore): score is [-100, 0, 0]; } /** @internal */ export declare type FuzzyScorer = (pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number, firstMatchCanBeWeak: boolean) => FuzzyScore | undefined; /** @internal */ export declare function fuzzyScore(pattern: string, patternLow: string, patternStart: number, word: string, wordLow: string, wordStart: number, firstMatchCanBeWeak: boolean): FuzzyScore | undefined; /** @internal */ export declare function fuzzyScoreGracefulAggressive(pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number, firstMatchCanBeWeak: boolean): FuzzyScore | undefined; /** @internal */ export declare function fuzzyScoreGraceful(pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number, firstMatchCanBeWeak: boolean): FuzzyScore | undefined; //# sourceMappingURL=filters.d.ts.map