@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
19 lines (17 loc) • 507 B
JavaScript
function merge(initialObj, mergeObj, levels = 2) {
if (!mergeObj || typeof mergeObj !== "object" || levels <= 0) {
return mergeObj;
}
if (initialObj && Object.keys(mergeObj).length === 0) {
return initialObj;
}
const output = { ...initialObj };
for (const key in mergeObj) {
if (Object.prototype.hasOwnProperty.call(mergeObj, key)) {
output[key] = merge(output[key], mergeObj[key], levels - 1);
}
}
return output;
}
export { merge };
//# sourceMappingURL=merge.js.map