{"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 \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 babyClone(obj) {\r\n switch (typeof obj) {\r\n case \u0027string\u0027:\r\n case \u0027number\u0027:\r\n case \u0027bigint\u0027:\r\n case \u0027boolean\u0027:\r\n case \u0027symbol\u0027:\r\n case \u0027undefined\u0027:\r\n return obj;\r\n case \u0027object\u0027:\r\n if (!obj) return null;\r\n if (Array.isArray(obj)) {\r\n return Array.prototype.map.call(obj, babyClone);\r\n }\r\n\t if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf({})) {\r\n\t // this won\u0027t catch Proxy\r\n\t throw \u0027trying to copy a class instance\u0027;\r\n\t }\r\n let copy = {};\r\n for (let sym of Object.getOwnPropertySymbols(obj)) {\r\n copy[sym] = babyClone(obj[sym]);\r\n }\r\n for (let key in obj) {\r\n copy[key] = babyClone(obj[key]);\r\n }\r\n return copy;\r\n case \u0027function\u0027:\r\n throw \u0027no copying things with functions in them\u0027;\r\n default:\r\n throw \u0027what new nonsense have they added to js\u0027;\r\n }\r\n}","TestCases":[{"Name":"window.structuredClone","Code":"const copy = window.structuredClone(voucher);","IsDeferred":false},{"Name":"Spread syntax","Code":"const copy = { ...voucher };","IsDeferred":false},{"Name":"Object assign","Code":"const copy = {};\r\nObject.assign(copy, voucher);","IsDeferred":false},{"Name":"babyClone","Code":"const copy = babyClone(voucher);","IsDeferred":false}]}