/* @flow */ export type MatcherOptions = { // Default: false caseSensitive?: boolean, // Default: infinite maxResults?: number, // Maximum gap to allow between consecutive letters in a match. // Provide a smaller maxGap to speed up query results. // Default: unlimited maxGap?: number; // Default: 1 numThreads?: number, // Default: false recordMatchIndexes?: boolean, } export type MatchResult = { value: string, // A number in the range (0-1]. Higher scores are more relevant. // 0 denotes "no match" and will never be returned. score: number, // Matching character index in `value` for each character in `query`. // This can be costly, so this is only returned if `recordMatchIndexes` was set in `options`. matchIndexes?: Array, } export class Matcher { constructor(candidates: Array) {} // Returns all matching candidates (subject to `options`). // Will be ordered by score, descending. match: (query: string, options?: MatcherOptions) => Array; addCandidates: (candidates: Array) => void; removeCandidates: (candidates: Array) => void; setCandidates: (candidates: Array) => void; }