{"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\nfunction set(obj, key, val) {\r\n\tif (typeof val.value === \u0027object\u0027) val.value = klona(val.value);\r\n\tif (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === \u0027__proto__\u0027) {\r\n\t\tObject.defineProperty(obj, key, val);\r\n\t} else obj[key] = val.value;\r\n}\r\n\r\nfunction klona(val) {\r\n\tvar k, out, tmp;\r\n\r\n\tif (Array.isArray(val)) {\r\n\t\tout = Array(k=val.length);\r\n\t\twhile (k--) out[k] = (tmp=val[k]) \u0026\u0026 typeof tmp === \u0027object\u0027 ? klona(tmp) : tmp;\r\n\t\treturn out;\r\n\t}\r\n\r\n\tif (Object.prototype.toString.call(val) === \u0027[object Object]\u0027) {\r\n\t\tout = {}; // null\r\n\t\tfor (k in val) {\r\n\t\t\tif (k === \u0027__proto__\u0027) {\r\n\t\t\t\tObject.defineProperty(out, k, {\r\n\t\t\t\t\tvalue: klona(val[k]),\r\n\t\t\t\t\tconfigurable: true,\r\n\t\t\t\t\tenumerable: true,\r\n\t\t\t\t\twritable: true,\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tout[k] = (tmp=val[k]) \u0026\u0026 typeof tmp === \u0027object\u0027 ? klona(tmp) : tmp;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn out;\r\n\t}\r\n\r\n\treturn val;\r\n}\r\n\r\nvar myCopy = null;","TestCases":[{"Name":"Native structuredClone","Code":"myCopy = structuredClone(MyObject);","IsDeferred":false},{"Name":"Klona","Code":"myCopy = klona(MyObject);","IsDeferred":false},{"Name":"Lodash","Code":"myCopy = _.cloneDeep(MyObject);","IsDeferred":false}]}