fix: handle invalid values in arrays (#61)
This commit is contained in:
parent
6f4ed9d662
commit
2dcc7efe6f
1 changed files with 28 additions and 4 deletions
|
|
@ -183,6 +183,10 @@ interface HasRequiredConfigMissingOptions {
|
|||
userConfig?: DxtUserConfigValues;
|
||||
}
|
||||
|
||||
function isInvalidSingleValue(value: unknown): boolean {
|
||||
return value === undefined || value === null || value === "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an extension has missing required configuration
|
||||
* @param manifest The extension manifest
|
||||
|
|
@ -203,10 +207,9 @@ export function hasRequiredConfigMissing({
|
|||
if (configOption.required) {
|
||||
const value = config[key];
|
||||
if (
|
||||
value === undefined ||
|
||||
value === null ||
|
||||
value === "" ||
|
||||
(Array.isArray(value) && value.length === 0)
|
||||
isInvalidSingleValue(value) ||
|
||||
(Array.isArray(value) &&
|
||||
(value.length === 0 || value.some(isInvalidSingleValue)))
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue