@fesjs/utils
Version:
23 lines (22 loc) • 479 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = mergeConfig;
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;
}