read-config-ng
Version:
Multi format configuration loader
20 lines • 601 B
JavaScript
import * as _ from 'lodash';
/**
* Merge multiple configuration objects
* Arrays are replaced, not merged
*/
export function mergeConfigs(configs) {
if (!configs || !configs.length) {
return {};
}
// Custom merge function: arrays are replaced, not merged
const customizer = (objValue, srcValue) => {
if (Array.isArray(objValue)) {
return srcValue;
}
return undefined; // Use default merging for other types
};
return _.mergeWith({}, ...configs, customizer);
}
export default mergeConfigs;
//# sourceMappingURL=merge-configs.js.map