mirror of
https://git.bits.team/Bits/mod-manager.git
synced 2025-06-30 17:19:43 -04:00
Added functionality to mark mods as essential
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user