@kamilkisiela/graphql-tools
Version:
Useful tools to create and manipulate GraphQL schemas.
26 lines • 887 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
function mergeDeep(target, source) {
var output = Object.assign({}, target);
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach(function (key) {
var _a, _b;
if (isObject(source[key])) {
if (!(key in target)) {
Object.assign(output, (_a = {}, _a[key] = source[key], _a));
}
else {
output[key] = mergeDeep(target[key], source[key]);
}
}
else {
Object.assign(output, (_b = {}, _b[key] = source[key], _b));
}
});
}
return output;
}
exports.default = mergeDeep;
function isObject(item) {
return item && typeof item === 'object' && !Array.isArray(item);
}
//# sourceMappingURL=mergeDeep.js.map