Fixed fallback imports

master
WolverinDEV 2021-02-14 17:22:53 +01:00
parent 1e66f2302c
commit 4c5dfbbb3b
1 changed files with 6 additions and 10 deletions

View File

@ -79,7 +79,6 @@ function resolveKey<ValueType extends RegistryValueType, DefaultType>(
resolver: (key: string) => string | undefined, resolver: (key: string) => string | undefined,
defaultValue: DefaultType defaultValue: DefaultType
) : ValueType | DefaultType { ) : ValueType | DefaultType {
let value = resolver(key.key); let value = resolver(key.key);
if(typeof value === "string") { if(typeof value === "string") {
return decodeValueFromString(value, key.valueType); return decodeValueFromString(value, key.valueType);
@ -92,17 +91,14 @@ function resolveKey<ValueType extends RegistryValueType, DefaultType>(
continue; continue;
} }
if(!key.fallbackImports) { if(key.fallbackImports) {
break; const fallbackValueImporter = key.fallbackImports[fallback];
if(fallbackValueImporter) {
return fallbackValueImporter(value);
}
} }
/* fallback key succeeded */ return decodeValueFromString(value, key.valueType);
const fallbackValueImporter = key.fallbackImports[fallback];
if(fallbackValueImporter) {
return fallbackValueImporter(value);
}
break;
} }
return defaultValue; return defaultValue;