{"ScriptPreparationCode":"var testInitialConfig = { key1: 123, key2: [], key3: { a: 123 } };\r\nvar testOverrideConfig = { key1: \u0027abc\u0027, key3: { a: [] } };\r\n\r\nvar funcReduce = (initialConfig, overrideConfig) =\u003E {\r\n if (!overrideConfig) {\r\n return { ...initialConfig };\r\n }\r\n\r\n const keys = Object.keys(initialConfig);\r\n\r\n return keys.reduce(\r\n (acc, key) =\u003E {\r\n if (overrideConfig[key]) {\r\n return {\r\n ...acc,\r\n [key]: {\r\n ...initialConfig[key],\r\n ...overrideConfig[key],\r\n },\r\n };\r\n }\r\n\r\n return acc;\r\n },\r\n { ...initialConfig },\r\n );\r\n};\r\n\r\nvar forInFunc = (initialConfig, overrideConfig) =\u003E {\r\n const mergedConfig = { ...initialConfig };\r\n\r\n if (!overrideConfig) {\r\n return mergedConfig;\r\n }\r\n\r\n for (const keyString in initialConfig) {\r\n const key = keyString;\r\n\r\n if (overrideConfig[key]) {\r\n mergedConfig[key] = {\r\n ...initialConfig[key],\r\n ...overrideConfig[key],\r\n };\r\n }\r\n }\r\n\r\n return mergedConfig;\r\n};\r\n","TestCases":[{"Name":"forInFunc","Code":"const result1 = forInFunc(testInitialConfig, testOverrideConfig)\r\nconsole.log(result1)","IsDeferred":false},{"Name":"funcReduce","Code":"const result2 = funcReduce(testInitialConfig, testOverrideConfig)\r\nconsole.log(result2)","IsDeferred":false}]}