{"ScriptPreparationCode":"var obj = [true, [1, 2, 3, 4, 5, 6, 7, 8, 9], \u0022true\u0022, [], {}, function() {}, {\r\n \u0022$type\u0022: \u0022PolygonStyleSettings\u0022,\r\n \u0022defaultStyle\u0022: {\r\n \u0022$type\u0022: \u0022PolygonStyle\u0022,\r\n \u0022line\u0022: {\r\n \u0022color\u0022: 4278190080,\r\n \u0022endCap\u0022: 2,\r\n \u0022join\u0022: 0,\r\n \u0022width\u0022: 1.0\r\n }\r\n },\r\n \u0022labelSettings\u0022: {\r\n \u0022enabled\u0022: false,\r\n \u0022labelAttrs\u0022: [\u0022NAME_1\u0022],\r\n \u0022labelComponents\u0022: [\u0022{{NAME_1}}\u0022],\r\n \u0022labelTemplate\u0022: \u0022{{NAME_1}}\u0022,\r\n \u0022labelling\u0022: \u0022OPTIMIZED\u0022\r\n }\r\n}];","TestCases":[{"Name":"spread ...","Code":"// Deep copies: true, 1, \u0022true\u0022\r\n// Shallow copies: [], {}, function () {}\r\nconst obj2 = { ...obj };","IsDeferred":false},{"Name":"esDeepClone2","Code":"function esDeepClone2(obj) {\r\n\r\n // Handle the 3 simple types, and null or undefined\r\n if (null == obj || \u0022object\u0022 != typeof obj) {\r\n return obj;\r\n }\r\n\r\n // Handle Number\r\n if (obj instanceof Number) {\r\n return JSON.parse(JSON.stringify(obj)); // converts back to primitive type\r\n }\r\n\r\n // Handle Date\r\n if (obj instanceof Date) {\r\n const copy = new Date();\r\n copy.setTime(obj.getTime());\r\n return copy;\r\n }\r\n\r\n // Handle Array\r\n if (obj instanceof Array) {\r\n const copy = [];\r\n for (let i = 0, len = obj.length; i \u003C len; i\u002B\u002B) {\r\n copy[i] = esDeepClone2(obj[i]);\r\n }\r\n return copy;\r\n }\r\n\r\n // Handle Object\r\n if (obj instanceof Object) {\r\n const copy = {};\r\n for (let attr in obj) {\r\n if (obj.hasOwnProperty(attr))\r\n copy[attr] = esDeepClone2(obj[attr]);\r\n }\r\n return copy;\r\n }\r\n\r\n // fallback, should never happen\r\n // console.trace()\r\n return JSON.parse(JSON.stringify(obj));\r\n}\r\n\r\n// Deep copies: true, 1, \u0022true\u0022\r\n// Shallow copies: [], {}, function () {}\r\nconst obj2 = esDeepClone2(obj);","IsDeferred":false},{"Name":"JSON.parse(JSON.stringify())","Code":"// Deep copies: true, 1, \u0022true\u0022, [], {}\r\n// Shallow copies: function () {}\r\nconst obj2 = JSON.parse(JSON.stringify(obj));","IsDeferred":false},{"Name":"Custom function","Code":"function copy(aObject) {\r\n // Prevent undefined objects\r\n // if (!aObject) return aObject;\r\n\r\n let bObject = Array.isArray(aObject) ? [] : {};\r\n\r\n let value;\r\n for (const key in aObject) {\r\n\r\n // Prevent self-references to parent object\r\n // if (Object.is(aObject[key], aObject)) continue;\r\n\r\n value = aObject[key];\r\n\r\n bObject[key] = (typeof value === \u0022object\u0022) ? copy(value) : value;\r\n }\r\n\r\n return bObject;\r\n}\r\n\r\n// Deep copies: true, 1, \u0022true\u0022, [], {}, function () {}\r\nconst obj2 = copy(obj);","IsDeferred":false},{"Name":"Lodash.cloneDeep()","Code":"// Deep copies: true, 1, \u0022true\u0022, [], {}, function () {}\r\nconst obj2 = _.cloneDeep(obj);","IsDeferred":false},{"Name":"jQuery.extend(true)","Code":"// Deep copies: true, 1, \u0022true\u0022, [], {}, function () {}\r\nconst obj2 = jQuery.extend(true, {}, obj);","IsDeferred":false},{"Name":"Object.assign","Code":"const obj2 = Object.assign({}, obj);","IsDeferred":false},{"Name":"chatGptDeepClone","Code":"function chatGptDeepClone(obj) {\r\n if (obj === null || typeof obj !== \u0027object\u0027) {\r\n return obj;\r\n }\r\n\r\n let clone = Array.isArray(obj) ? [] : {};\r\n\r\n for (let key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n clone[key] = chatGptDeepClone(obj[key]);\r\n }\r\n }\r\n\r\n return clone;\r\n}\r\n\r\nconst obj2 = chatGptDeepClone({}, obj);","IsDeferred":false}]}