You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/src/validate/utils/fuzzymatch.ts

10 lines
245 B

import FuzzySet from './FuzzySet.ts';
export default function fuzzymatch ( name, names ) {
const set = new FuzzySet( names );
const matches = set.get( name );
return matches && matches[0] && matches[0][0] > 0.7 ?
matches[0][1] :
null;
}