mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
fix enum value deserialization (#609)
This commit is contained in:
parent
2537ded3c2
commit
192c1947a6
@ -41,7 +41,11 @@ class EnumHelper<EnumObj extends object, EnumMember extends Member<EnumObj> & st
|
|||||||
fuzzyGetMember(input: string): EnumMember | undefined;
|
fuzzyGetMember(input: string): EnumMember | undefined;
|
||||||
fuzzyGetMember(input: string, alwaysMatch: true): EnumMember;
|
fuzzyGetMember(input: string, alwaysMatch: true): EnumMember;
|
||||||
fuzzyGetMember(input: string, alwaysMatch = false) {
|
fuzzyGetMember(input: string, alwaysMatch = false) {
|
||||||
return this.fuzzMap.get(input.toLowerCase().replace(/[ -]+/g, "")) ?? alwaysMatch ? this.valueArray[0] : undefined;
|
const matchedValue = this.fuzzMap.get(input.toLowerCase().replace(/[ -]+/g, ""));
|
||||||
|
if (matchedValue) {
|
||||||
|
return matchedValue;
|
||||||
|
}
|
||||||
|
return alwaysMatch ? this.valueArray[0] : undefined;
|
||||||
}
|
}
|
||||||
/** Provide a case sensitive match, or undefined if */
|
/** Provide a case sensitive match, or undefined if */
|
||||||
getMember(input: unknown): EnumMember | undefined {
|
getMember(input: unknown): EnumMember | undefined {
|
||||||
|
Loading…
Reference in New Issue
Block a user