{"ScriptPreparationCode":null,"TestCases":[{"Name":"lodash merge","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027, d: \u0027ss\u0027 };\r\nvar b = { c: \u0027goddess\u0027, d: \u0027s2s\u0027 };\r\nvar c = _.merge(a, b);\r\nconsole.log(\u0027merge\u0027, c)","IsDeferred":false},{"Name":"object.assign","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027, d: \u0027ss\u0027 };\r\nvar b = { c: \u0027goddess\u0027, d: \u0027s2s\u0027 };\r\nvar c = Object.assign(a, b);\r\nconsole.log(\u0027assign\u0027, c)","IsDeferred":false},{"Name":"spread","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027, d: \u0027ss\u0027 };\r\nvar b = { c: \u0027goddess\u0027, d: \u0027s2s\u0027 };\r\nvar c = { ...a, ...b };\r\nconsole.log(\u0027spread\u0027, c)","IsDeferred":false},{"Name":"lodash mergeWith","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027, d: \u0027ss\u0027 };\r\nvar b = { c: \u0027goddess\u0027, d: \u0027s2s\u0027 };\r\nvar c = _.mergeWith(a, b);\r\nconsole.log(\u0027mergeWith\u0027, c)","IsDeferred":false},{"Name":"My test","Code":"var a = { a: \u0027oh\u0027, b: \u0027my\u0027, d: \u0027ss\u0027 };\r\nvar b = { c: \u0027goddess\u0027, d: \u0027s2s\u0027 };\r\n const customMerge = (a, b) =\u003E {\r\n const result = Object.assign({}, a, b);\r\n\r\n Object.keys(result).forEach(key =\u003E {\r\n if (typeof a[key] !== \u0027object\u0027 || typeof b[key] !== \u0027object\u0027) {\r\n return;\r\n }\r\n\r\n Object.assign(result, { [key]: Object.assign(a[key], b[key]) });\r\n });\r\n\r\n return result;\r\n};\r\nvar c = customMerge(a, b);\r\n\r\nconsole.log(\u0027customMerge\u0027, c)","IsDeferred":false}]}