mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-05 20:54:27 +08:00
26 lines
557 B
JavaScript
26 lines
557 B
JavaScript
const massageConfiguration = (config, identifier) => {
|
|
let result = {};
|
|
|
|
const addons = Object.keys(config);
|
|
if (addons.length > 0) {
|
|
|
|
result = {
|
|
[identifier]: {}
|
|
};
|
|
|
|
addons.forEach(
|
|
addon => Object.keys(config[addon])
|
|
.forEach(
|
|
component => {
|
|
if (config[addon][component].areas.indexOf(identifier) !== -1) {
|
|
result[identifier][component] = config[addon][component];
|
|
}
|
|
}
|
|
)
|
|
);
|
|
}
|
|
|
|
return result;
|
|
};
|
|
|
|
export default massageConfiguration;
|