fuzzyMatch.d.ts 1.1 KB

123456789101112131415161718192021
  1. export declare function fuzzyCheckStrings(inputValues: string[], validValues: string[], allSuggestions: string[]): {
  2. [p: string]: string[];
  3. };
  4. /**
  5. *
  6. * @param {String} inputValue The value to be compared against a list of strings
  7. * @param allSuggestions The list of strings to be compared against
  8. * @param hideIrrelevant By default, fuzzy suggestions will just sort the allSuggestions list, set this to true
  9. * to filter out the irrelevant values
  10. * @param weighted Set this to true, to make letters matched in the order they were typed have priority in the results.
  11. */
  12. export declare function fuzzySuggestions(inputValue: string, allSuggestions: string[], hideIrrelevant?: boolean, weighted?: true): string[];
  13. /**
  14. * Algorithm to do fuzzy search
  15. * from https://stackoverflow.com/questions/23305000/javascript-fuzzy-search-that-makes-sense
  16. * @param {string} from
  17. * @return {[]}
  18. */
  19. export declare function get_bigrams(from: string): any[];
  20. export declare function string_distances(str1: string, str2: string): number;
  21. export declare function string_weighted_distances(str1: string, str2: string): number;