{"ScriptPreparationCode":"var cur = (obj) =\u003E {\r\n let clone;\r\n if (Array.isArray(obj)) {\r\n clone = [];\r\n for (const x of obj) {\r\n clone.push(cur(x));\r\n }\r\n } else if (obj !== null \u0026\u0026 typeof obj === \u0027object\u0027) {\r\n clone = {};\r\n for (const [k, v] of Object.entries(obj)) {\r\n clone[k] = cur(v);\r\n }\r\n } else if (ArrayBuffer.isView(obj)) {\r\n throw new TypeError(\u0022TypedArray not implemented\u0022);\r\n } else if (obj instanceof ArrayBuffer) {\r\n throw new TypeError(\u0022ArrayBuffer not implemented\u0022);\r\n } else if (obj != null \u0026\u0026 ![\u0027string\u0027, \u0027number\u0027, \u0027boolean\u0027].includes(typeof obj)) {\r\n throw new TypeError(\u0022Unexpected primative type\u0022);\r\n } else {\r\n clone = obj;\r\n }\r\n return clone;\r\n};\r\n\r\nvar fori = (obj) =\u003E {\r\n if (obj) {\r\n const objType = typeof obj;\r\n if (obj.length !== undefined \u0026\u0026 obj instanceof Array) {\r\n const clone = Array.from(obj);\r\n for (let i = 0, len = obj.length; i \u003C len; i\u002B\u002B) {\r\n const v = obj[i];\r\n const vType = typeof v;\r\n if (v \u0026\u0026 vType !== \u0027string\u0027 \u0026\u0026 vType !== \u0027number\u0027 \u0026\u0026 vType !== \u0027boolean\u0027) {\r\n clone[i] = fori(v);\r\n }\r\n }\r\n return clone;\r\n } else if (obj !== null \u0026\u0026 objType === \u0027object\u0027) {\r\n const clone = {\r\n ...obj\r\n };\r\n const keys = Object.keys(obj);\r\n for (let i = 0, len = keys.length; i \u003C len; i\u002B\u002B) {\r\n const v = obj[keys[i]];\r\n const vType = typeof v;\r\n if (v \u0026\u0026 vType !== \u0027string\u0027 \u0026\u0026 vType !== \u0027number\u0027 \u0026\u0026 vType !== \u0027boolean\u0027) {\r\n clone[keys[i]] = fori(v);\r\n }\r\n }\r\n return clone;\r\n } else if (objType === \u0027string\u0027 || objType === \u0027number\u0027 || objType === \u0027boolean\u0027) {\r\n return obj;\r\n } else {\r\n throw new TypeError(\u0022Unexpected type\u0022);\r\n }\r\n } else {\r\n return obj;\r\n }\r\n return clone;\r\n};\r\n\r\n\r\n\r\nvar data = Array.from(Array(1000)).map((x, i) =\u003E ({\r\n i,\r\n b: [1, 2, 3, 5, 6, 7],\r\n c: 111,\r\n d: 222,\r\n e: {\r\n aa: 1,\r\n bb: 1\r\n },\r\n b: false,\r\n s: \u0027asdfaasdfaasdfasdfasdf\u0027,\r\n n: null,\r\n}));","TestCases":[{"Name":"fori","Code":"fori(data);","IsDeferred":false},{"Name":"cur","Code":"cur(data);","IsDeferred":false}]}