UNPKG

@odoo/o-spreadsheet

Version:
20 lines (19 loc) 867 B
/** Methods from Odoo Web Utils */ /** * This function computes a score that represent the fact that the * string contains the pattern, or not * * - If the score is 0, the string does not contain the letters of the pattern in * the correct order. * - if the score is > 0, it actually contains the letters. * * Better matches will get a higher score: consecutive letters are better, * and a match closer to the beginning of the string is also scored higher. */ export declare function fuzzyMatch(pattern: string, str: string): number; /** * Return a list of things that matches a pattern, ordered by their 'score' ( * higher score first). An higher score means that the match is better. For * example, consecutive letters are considered a better match. */ export declare function fuzzyLookup<T>(pattern: string, list: T[], fn: (t: T) => string): T[];