@daysnap/utils
Version:
27 lines (21 loc) • 713 B
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});
var _chunkOSEQ7XR6cjs = require('./chunk-OSEQ7XR6.cjs');
// src/merge.ts
function merge(target, ...sources) {
sources.forEach((source) => {
if (!_chunkOSEQ7XR6cjs.isObject.call(void 0, source)) {
return;
}
Object.keys(source).forEach((key) => {
const sourceValue = source[key];
const targetValue = target[key];
if (_chunkOSEQ7XR6cjs.isObject.call(void 0, targetValue) && _chunkOSEQ7XR6cjs.isObject.call(void 0, sourceValue)) {
target[key] = merge(targetValue, sourceValue);
} else {
target[key] = sourceValue;
}
});
});
return target;
}
exports.merge = merge;