refactor(massageConfiguration): Create response only when we have addons

Signed-off-by: Adrian Oprea <adrian@oprea.rocks>
This commit is contained in:
Adrian Oprea 2018-01-17 14:39:42 +02:00
parent d71f6161e4
commit 4b9013bcab

View file

@ -1,10 +1,14 @@
const massageConfiguration = (config, identifier) => { const massageConfiguration = (config, identifier) => {
const result = { let result = {};
[identifier]: {}
};
Object.keys(config) const addons = Object.keys(config);
.forEach( if (addons) {
result = {
[identifier]: {}
};
addons.forEach(
addon => Object.keys(config[addon]) addon => Object.keys(config[addon])
.forEach( .forEach(
component => { component => {
@ -13,7 +17,8 @@ const massageConfiguration = (config, identifier) => {
} }
} }
) )
); );
}
return result; return result;
}; };