@daysnap/utils
Version:
27 lines (24 loc) • 533 B
JavaScript
import {
isObject
} from "./chunk-XCSSSEK2.js";
// src/merge.ts
function merge(target, ...sources) {
sources.forEach((source) => {
if (!isObject(source)) {
return;
}
Object.keys(source).forEach((key) => {
const sourceValue = source[key];
const targetValue = target[key];
if (isObject(targetValue) && isObject(sourceValue)) {
target[key] = merge(targetValue, sourceValue);
} else {
target[key] = sourceValue;
}
});
});
return target;
}
export {
merge
};