{"ScriptPreparationCode":"var MyObject = {\r\n description: \u0027Creates a deep copy of source, which should be an object or an array.\u0027,\r\n myNumber: 123456789,\r\n myBoolean: true,\r\n jayson: {\r\n stringify: \u0027JSON.stringify() method converts a JavaScript value to a JSON string....\u0027,\r\n parse: \u0027JSON.parse() method parses a JSON string...\u0027\r\n }\r\n};\r\n\r\nvar myCopy = null;\r\n\r\nvar jsondiffpatchClone = jsondiffpatch.clone;\r\nvar rfdcClone = rfdc();\r\n\r\n///////////////////////////////////////////////////////////////////\r\nfunction recursiveDeepCopy(o) {\r\n var newO,\r\n i;\r\n \r\n if (typeof o !== \u0027object\u0027) {\r\n return o;\r\n }\r\n if (!o) {\r\n return o;\r\n }\r\n \r\n if (\u0027[object Array]\u0027 === Object.prototype.toString.apply(o)) {\r\n newO = [];\r\n for (i = 0; i \u003C o.length; i \u002B= 1) {\r\n newO[i] = recursiveDeepCopy(o[i]);\r\n }\r\n return newO;\r\n }\r\n \r\n newO = {};\r\n for (i in o) {\r\n if (o.hasOwnProperty(i)) {\r\n newO[i] = recursiveDeepCopy(o[i]);\r\n }\r\n }\r\n return newO;\r\n }\r\n//////////////////////////////////////////////////////////////////\r\n// Use https://www.npmjs.com/package/fastest-json-copy\r\n// Instead of the code below! It is the same thing, just minified.\r\nvar isArray=Array.isArray;function fastestJsonCopy(r){if(!r)return r;if(isArray(r)){for(var e=[],o=r.length,t=0;t\u003Co;t\u002B\u002B)e.push(fastestJsonCopy(r[t]));return e}if(\u0022object\u0022==typeof r){var y=Object.keys(r),a=(o=y.length,{});for(t=0;t\u003Co;t\u002B\u002B){var c=y[t];a[c]=fastestJsonCopy(r[c])}return a}return r}\r\n","TestCases":[{"Name":"lodash cloneDeep","Code":"myCopy = _.cloneDeep(MyObject);","IsDeferred":false},{"Name":"JSON.parse(JSON.stringify())","Code":"myCopy = JSON.parse(JSON.stringify(MyObject));","IsDeferred":false},{"Name":"recursiveDeepCopy","Code":"myCopy = recursiveDeepCopy(MyObject);","IsDeferred":false},{"Name":"fastest-json-copy npm package","Code":"myCopy = fastestJsonCopy(MyObject);","IsDeferred":false},{"Name":"jsondiffpatch.clone()","Code":"myCopy = jsondiffpatchClone(MyObject);","IsDeferred":false},{"Name":"rfdc","Code":"myCopy = rfdcClone(MyObject);","IsDeferred":false}]}