{"ScriptPreparationCode":"function isObject(item) {\r\n return (item \u0026\u0026 typeof item === \u0027object\u0027 \u0026\u0026 !Array.isArray(item));\r\n}\r\n\r\nfunction mergeDeep(target, ...sources) {\r\n if (!sources.length) return target;\r\n const source = sources.shift();\r\n\r\n if (isObject(target) \u0026\u0026 isObject(source)) {\r\n for (const key in source) {\r\n if (isObject(source[key])) {\r\n if (!target[key]) Object.assign(target, { [key]: {} });\r\n mergeDeep(target[key], source[key]);\r\n } else {\r\n Object.assign(target, { [key]: source[key] });\r\n }\r\n }\r\n }\r\n return mergeDeep(target, ...sources);\r\n}","TestCases":[{"Name":"Lodash","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027 };\r\nvar b = { c: \u0027goddess\u0027 };\r\nvar c = _.merge(a, b);\r\n","IsDeferred":false},{"Name":"mergeDeep using object.assign","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027 };\r\nvar b = { c: \u0027goddess\u0027 };\r\nvar c = mergeDeep(a, b);","IsDeferred":false}]}