Added functionality to mark mods as essential

This commit is contained in:
Kallum Jones
2022-08-04 16:04:21 +01:00
parent ab83374735
commit e913bafb1e
11 changed files with 106 additions and 29 deletions

View File

@ -1,4 +1,8 @@
import { stringSimilarity } from "string-similarity-js";
export default class Util {
private static readonly SIMILARITY_THRESHOLD: number = 0.8;
static isArrayEmpty(array: Array<any> | undefined): boolean {
return array === undefined || array.length == 0;
}
@ -9,4 +13,10 @@ export default class Util {
// uppercase the first character
.replace(/^./, function(str){ return str.toUpperCase(); })
}
static areStringsSimilar(master: string, compare: string): boolean {
master = master.toLowerCase();
compare = compare.toLowerCase();
return stringSimilarity(master, compare) >= this.SIMILARITY_THRESHOLD;
}
}