UNPKG

887 BJavaScriptView Raw
1Object.defineProperty(exports, "__esModule", { value: true });
2function mergeDeep(target, source) {
3 var output = Object.assign({}, target);
4 if (isObject(target) && isObject(source)) {
5 Object.keys(source).forEach(function (key) {
6 var _a, _b;
7 if (isObject(source[key])) {
8 if (!(key in target)) {
9 Object.assign(output, (_a = {}, _a[key] = source[key], _a));
10 }
11 else {
12 output[key] = mergeDeep(target[key], source[key]);
13 }
14 }
15 else {
16 Object.assign(output, (_b = {}, _b[key] = source[key], _b));
17 }
18 });
19 }
20 return output;
21}
22exports.default = mergeDeep;
23function isObject(item) {
24 return item && typeof item === 'object' && !Array.isArray(item);
25}
26//# sourceMappingURL=mergeDeep.js.map
\No newline at end of file