fix(core): update
This commit is contained in:
@ -54,7 +54,7 @@ export class ArticleSearch {
|
||||
weight: 1,
|
||||
},
|
||||
],
|
||||
includeMatches: true
|
||||
includeMatches: true,
|
||||
});
|
||||
this.readyDeferred.resolve();
|
||||
} else {
|
||||
|
@ -3,7 +3,6 @@ import * as plugins from './smartfuzzy.plugins';
|
||||
export class ObjectSorter<T> {
|
||||
public objectDictionary: T[];
|
||||
|
||||
|
||||
constructor(objectDictionaryArg: T[] = []) {
|
||||
this.objectDictionary = objectDictionaryArg;
|
||||
}
|
||||
@ -16,11 +15,10 @@ export class ObjectSorter<T> {
|
||||
distance: 100,
|
||||
maxPatternLength: 32,
|
||||
minMatchCharLength: 1,
|
||||
keys: objectKeysArg
|
||||
keys: objectKeysArg,
|
||||
};
|
||||
const fuse = new plugins.fuseJs<T>(this.objectDictionary, fuseOptions);
|
||||
const result = fuse.search(stringArg);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,16 +1,12 @@
|
||||
// @pushrocks scope
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
export {
|
||||
smartpromise
|
||||
}
|
||||
export { smartpromise };
|
||||
|
||||
// @tsclass scope
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
||||
export {
|
||||
tsclass
|
||||
}
|
||||
export { tsclass };
|
||||
|
||||
// third party scope
|
||||
import leven from 'leven';
|
||||
|
Reference in New Issue
Block a user