{"ScriptPreparationCode":"var deepMerge = (\r\n target,\r\n source,\r\n) =\u003E {\r\n var result = target;\r\n\r\n Object.keys(source)\r\n .forEach((key) =\u003E {\r\n if (Array.isArray(source[key])) {\r\n if (source[key].length \u003E 0) {\r\n result[key] = [...source[key]];\r\n } else {\r\n delete result[key];\r\n }\r\n } else if (_.isObject(source[key]) \u0026\u0026 _.isObject(target[key])) {\r\n result[key] = deepMerge({ ...target[key] }, source[key]);\r\n } else {\r\n result[key] = source[key];\r\n }\r\n });\r\n\r\n return result;\r\n};\r\n","TestCases":[{"Name":"lodash merge","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027 };\r\nvar b = { c: \u0027goddess\u0027 };\r\nvar c = _.merge(a, b);","IsDeferred":false},{"Name":"object.assign","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027 };\r\nvar b = { c: \u0027goddess\u0027 };\r\nvar c = Object.assign(a, b);","IsDeferred":false},{"Name":"spread","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027 };\r\nvar b = { c: \u0027goddess\u0027 };\r\nvar c = { ...a, ...b };","IsDeferred":false},{"Name":"deepMerge","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027 };\r\nvar b = { c: \u0027goddess\u0027 };\r\nvar c = deepMerge(a, b);","IsDeferred":false}]}