mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
16 lines
442 B
JavaScript
16 lines
442 B
JavaScript
export default function mergeConfig(defaultConfig, ...configs) {
|
|
const ret = { ...defaultConfig };
|
|
configs.forEach((config) => {
|
|
if (!config) return;
|
|
Object.keys(config).forEach((key) => {
|
|
const val = config[key];
|
|
if (typeof val === 'function') {
|
|
ret[key] = val(ret[key]);
|
|
} else {
|
|
ret[key] = val;
|
|
}
|
|
});
|
|
});
|
|
return ret;
|
|
}
|