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