@springernature/nn-charts
Version:
Visualization for DAS products
26 lines (25 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mergeConfigs = mergeConfigs;
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
// Helper method to recursively merge configs
function mergeConfigs(target, source) {
// For each property in source
for (var key in source) {
// If property is an object and not null
if (source[key] && _typeof(source[key]) === 'object' && !Array.isArray(source[key])) {
// If target doesn't have the property or it's not an object, create it
if (!target[key] || _typeof(target[key]) !== 'object') {
target[key] = {};
}
// Recurse
mergeConfigs(target[key], source[key]);
} else {
// Otherwise just copy the property
target[key] = source[key];
}
}
return target;
}