generated from Seekra/repository-template
add settings configuration parser #78
@@ -57,10 +57,7 @@ function validateEntry(entry, path) {
|
|||||||
assertString(entry.name, `${path}.name`);
|
assertString(entry.name, `${path}.name`);
|
||||||
assertString(entry.i18n, `${path}.i18n`);
|
assertString(entry.i18n, `${path}.i18n`);
|
||||||
|
|
||||||
if (entry.default === undefined) {
|
if (entry.default !== undefined) {
|
||||||
|
jakob.scheid marked this conversation as resolved
Outdated
|
|||||||
throw new Error(`[settings] "${path}.default" is required`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry.type === 'bool' && typeof entry.default !== 'boolean') {
|
if (entry.type === 'bool' && typeof entry.default !== 'boolean') {
|
||||||
throw new Error(`[settings] "${path}.default" must be a boolean`);
|
throw new Error(`[settings] "${path}.default" must be a boolean`);
|
||||||
}
|
}
|
||||||
@@ -76,6 +73,7 @@ function validateEntry(entry, path) {
|
|||||||
throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`);
|
throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
jakob.scheid marked this conversation as resolved
Outdated
jakob.scheid
commented
I think it should have a default value ( I think it should have a default value (`false`) that is used if it is not specified.
|
|||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user
Not every setting does need a default value. I suggest omitting this check.