{"ScriptPreparationCode":"var sampleObject = [{\r\n \u0022id\u0022: \u00220001\u0022,\r\n \u0022type\u0022: \u0022donut\u0022,\r\n \u0022name\u0022: \u0022Cake\u0022,\r\n \u0022ppu\u0022: 0.55,\r\n \u0022batters\u0022: {\r\n \u0022batter\u0022: [{\r\n \u0022id\u0022: \u00221001\u0022,\r\n \u0022type\u0022: \u0022Regular\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00221002\u0022,\r\n \u0022type\u0022: \u0022Chocolate\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00221003\u0022,\r\n \u0022type\u0022: \u0022Blueberry\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00221004\u0022,\r\n \u0022type\u0022: \u0022Devil\u0027s Food\u0022\r\n }\r\n ]\r\n },\r\n \u0022topping\u0022: [{\r\n \u0022id\u0022: \u00225001\u0022,\r\n \u0022type\u0022: \u0022None\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225002\u0022,\r\n \u0022type\u0022: \u0022Glazed\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225005\u0022,\r\n \u0022type\u0022: \u0022Sugar\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225007\u0022,\r\n \u0022type\u0022: \u0022Powdered Sugar\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225006\u0022,\r\n \u0022type\u0022: \u0022Chocolate with Sprinkles\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225003\u0022,\r\n \u0022type\u0022: \u0022Chocolate\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225004\u0022,\r\n \u0022type\u0022: \u0022Maple\u0022\r\n }\r\n ]\r\n },\r\n {\r\n \u0022id\u0022: \u00220002\u0022,\r\n \u0022type\u0022: \u0022donut\u0022,\r\n \u0022name\u0022: \u0022Raised\u0022,\r\n \u0022ppu\u0022: 0.55,\r\n \u0022batters\u0022: {\r\n \u0022batter\u0022: [{\r\n \u0022id\u0022: \u00221001\u0022,\r\n \u0022type\u0022: \u0022Regular\u0022\r\n }]\r\n },\r\n \u0022topping\u0022: [{\r\n \u0022id\u0022: \u00225001\u0022,\r\n \u0022type\u0022: \u0022None\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225002\u0022,\r\n \u0022type\u0022: \u0022Glazed\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225005\u0022,\r\n \u0022type\u0022: \u0022Sugar\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225003\u0022,\r\n \u0022type\u0022: \u0022Chocolate\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225004\u0022,\r\n \u0022type\u0022: \u0022Maple\u0022\r\n }\r\n ]\r\n },\r\n {\r\n \u0022id\u0022: \u00220003\u0022,\r\n \u0022type\u0022: \u0022donut\u0022,\r\n \u0022name\u0022: \u0022Old Fashioned\u0022,\r\n \u0022ppu\u0022: 0.55,\r\n \u0022batters\u0022: {\r\n \u0022batter\u0022: [{\r\n \u0022id\u0022: \u00221001\u0022,\r\n \u0022type\u0022: \u0022Regular\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00221002\u0022,\r\n \u0022type\u0022: \u0022Chocolate\u0022\r\n }\r\n ]\r\n },\r\n \u0022topping\u0022: [{\r\n \u0022id\u0022: \u00225001\u0022,\r\n \u0022type\u0022: \u0022None\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225002\u0022,\r\n \u0022type\u0022: \u0022Glazed\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225003\u0022,\r\n \u0022type\u0022: \u0022Chocolate\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00225004\u0022,\r\n \u0022type\u0022: \u0022Maple\u0022\r\n }\r\n ]\r\n }\r\n];\r\n\r\nvar myCopy = null;","TestCases":[{"Name":"myCopy = _.cloneDeep(sampleObject);","Code":"myCopy = _.cloneDeep(sampleObject);","IsDeferred":false},{"Name":"JSON Clone","Code":"myCopy = JSON.parse(JSON.stringify(sampleObject));","IsDeferred":false},{"Name":"RFDC \u6DF1\u5EA6\u62F7\u8D1D","Code":"var clone = rfdc({ proto: false,circles: false }); myCopy = clone(sampleObject);","IsDeferred":false},{"Name":"\u9012\u5F52 ","Code":"function deepCopy(data) {\r\n const t = typeof(data);\r\n let o;\r\n\r\n if (t === \u0027array\u0027) {\r\n o = [];\r\n } else if (t === \u0027object\u0027) {\r\n o = {};\r\n } else {\r\n return data;\r\n }\r\n\r\n if (t === \u0027array\u0027) {\r\n for (let i = 0; i \u003C data.length; i\u002B\u002B) {\r\n o.push(deepCopy(data[i]));\r\n }\r\n } else if (t === \u0027object\u0027) {\r\n for (const i in data) {\r\n if (!data.hasOwnProperty(i)) { continue; }\r\n o[i] = deepCopy(data[i]);\r\n }\r\n }\r\n return o;\r\n}\r\n\r\nmyCopy = deepCopy(sampleObject)","IsDeferred":false},{"Name":"klona test","Code":"myCopy = klona(sampleObject);","IsDeferred":false}]}