{"ScriptPreparationCode":"var voucher = {\r\n \u0022single\u0022: false,\r\n \u0022applyOverTaxes\u0022: false,\r\n \u0022discountType\u0022: \u00221\u0022,\r\n \u0022value\u0022: 100,\r\n \u0022minimumAmount\u0022: 0,\r\n \u0022quantity\u0022: 1,\r\n \u0022suffixLength\u0022: 8,\r\n \u0022code\u0022: \u0022IF5R0AFX\u0022,\r\n \u0022vertical\u0022: [],\r\n \u0022allowedPaymentMethods\u0022: [],\r\n \u0022allowedBanks\u0022: [],\r\n \u0022types\u0022: [],\r\n \u0022partners\u0022: [],\r\n \u0022deepvalue\u0022: {\u0022this\u0022: \u0022that\u0022},\r\n \u0022startDate\u0022: \u00222020-10-21T00:00:00.000Z\u0022,\r\n \u0022endDate\u0022: \u00222020-10-21T00:00:00.000Z\u0022,\r\n \u0022applyed\u0022: false\r\n}\r\n\r\nfunction deepClone(o) {\r\n if (typeof o !== \u0022object\u0022) {\r\n return o\r\n }\r\n if (!o) {\r\n return o\r\n }\r\n\r\n // https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25\r\n if (Array.isArray(o)) {\r\n const newO = []\r\n for (let i = 0; i \u003C o.length; i \u002B= 1) {\r\n const val = !o[i] || typeof o[i] !== \u0022object\u0022 ? o[i] : deepClone(o[i])\r\n newO[i] = val === undefined ? null : val\r\n }\r\n return newO\r\n }\r\n\r\n const newO = {}\r\n for (const i of Object.keys(o)) {\r\n const val = !o[i] || typeof o[i] !== \u0022object\u0022 ? o[i] : deepClone(o[i])\r\n if (val === undefined) {\r\n continue\r\n }\r\n newO[i] = val\r\n }\r\n return newO\r\n }\r\n\r\n","TestCases":[{"Name":"structuredClone","Code":"const copy = structuredClone(voucher);","IsDeferred":false},{"Name":"deepClone https://github.com/nodejs/node/issues/34355#issuecomment-658394617","Code":"const copy = deepClone(voucher);","IsDeferred":false}]}