{"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 mySet: new Set([1,2,3,1]),\r\n myList: [1,3,4,5,67,\u0027ab\u0027],\r\n myDate: new Date(),\r\n};\r\n\r\nvar myCopy = null;","TestCases":[{"Name":"JSON.stringify","Code":"myCopy = JSON.parse(JSON.stringify(MyObject));","IsDeferred":false},{"Name":"structuredClone","Code":"myCopy = structuredClone(MyObject);","IsDeferred":false},{"Name":"cloneLineageData","Code":"const cloneLineageData = (toClone) =\u003E {\r\n if (typeof toClone !== \u0027object\u0027 || toClone === null) return toClone;\r\n\r\n if (toClone instanceof Set) {\r\n return new Set(toClone);\r\n }\r\n\r\n if (Array.isArray(toClone)) {\r\n return toClone.map(cloneLineageData);\r\n }\r\n\r\n if (toClone instanceof Date) {\r\n return new Date(toClone);\r\n }\r\n\r\n const cloned = { ...toClone };\r\n const clonedObjKeys = Object.keys(cloned);\r\n\r\n for (let i = 0; i \u003C clonedObjKeys.length; i \u002B= 1) {\r\n const key = clonedObjKeys[i];\r\n cloned[key] = cloneLineageData(cloned[key]);\r\n }\r\n\r\n return cloned;\r\n};\r\n\r\nmyCopy = cloneLineageData(MyObject);","IsDeferred":false},{"Name":"lodash.cloneDeep","Code":"myCopy = _.cloneDeep(MyObject);","IsDeferred":false}]}