fix(core): update

This commit is contained in:
2021-10-03 17:37:03 +02:00
parent de87e314c0
commit d4cea26fb5
15 changed files with 194 additions and 130 deletions

View File

@@ -38,7 +38,7 @@ export class Smartfuzzy {
const fuseDictionary: { name: string }[] = [];
for (const wordArg of this.dictionary) {
fuseDictionary.push({
name: wordArg
name: wordArg,
});
}
const fuseOptions = {
@@ -48,13 +48,13 @@ export class Smartfuzzy {
distance: 100,
maxPatternLength: 32,
minMatchCharLength: 1,
keys: ['name']
keys: ['name'],
};
const fuse = new plugins.fuseJs(fuseDictionary, fuseOptions);
const fuzzyResult = fuse.search(stringArg);
let closestMatch: string = null;
if(fuzzyResult.length > 0) {
closestMatch = fuzzyResult[0].item.name
if (fuzzyResult.length > 0) {
closestMatch = fuzzyResult[0].item.name;
}
return closestMatch;
}