mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-09 14:46:47 +08:00
The meta-configuration structure imposes we change the way `react-hijack` parses and pulls its data. Because that work is both error-prone and also time-consuming, we chose to implement a function that would "massage" the data so it fits the current way react-hijack expects it.
21 lines
475 B
JavaScript
21 lines
475 B
JavaScript
const massageConfiguration = (config, identifier) => {
|
|
const result = {
|
|
[identifier]: {}
|
|
};
|
|
|
|
Object.keys(config)
|
|
.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;
|