adds check for globalConfigs before attempting to loop
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
const { MissingGlobalLabel, DuplicateGlobalLabel } = require('../errors');
|
||||
|
||||
module.exports = function validateGlobal(globalConfigs, Globals) {
|
||||
Object.values(globalConfigs).forEach((config) => {
|
||||
if (!config.label) {
|
||||
throw new MissingGlobalLabel(config);
|
||||
}
|
||||
if (Globals && Globals[config.label]) {
|
||||
throw new DuplicateGlobalLabel(config);
|
||||
}
|
||||
});
|
||||
if (globalConfigs) {
|
||||
Object.values(globalConfigs).forEach((config) => {
|
||||
if (!config.label) {
|
||||
throw new MissingGlobalLabel(config);
|
||||
}
|
||||
if (Globals && Globals[config.label]) {
|
||||
throw new DuplicateGlobalLabel(config);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user