{"ScriptPreparationCode":"// deep copy:\r\n// String, Number, undefined, null, Set, Map, typed Array, Object, Boolean, RegExp, Date, ArrayBuffer\r\n// Functions, Properties of types: (Primitive, Symbol)\r\n// shallow copy (by reference):\r\n// WeakMap, WeakSet, Symbol\r\nfunction deepCopy(o) {\r\n if ((typeof o !== \u0022object\u0022 || o === null) \u0026\u0026 !(o instanceof Function)) return o; // fast obj/null test\r\n let n, keys;\r\n const c = o.constructor;\r\n if (o[Symbol.iterator] instanceof Function) { // fast array test\r\n // Map and Set have no length property so they will be correctly constructed\r\n const l = o.length;\r\n n = (new c(l));\r\n switch (c) {\r\n case Set:\r\n for (let e of o) n.add(deepCopy(e));\r\n break;\r\n case Map:\r\n for (let [key, value] of o) n.set(key, deepCopy(value));\r\n break;\r\n }\r\n for (let i of Object.keys(o)) n[i] = deepCopy(o[i]);\r\n } else {\r\n if (c !== Object) {\r\n switch (c) {\r\n case Function:\r\n let str = o.toString();\r\n if(/ \\[native code\\] /.exec(str) === null){\r\n let args=/^.*?\\((.*?)\\)/.exec(str)[1];//.split(/,/);\r\n let func=/^.*?{(.*)}/.exec(str)[1];\r\n n=new c(args,func);\r\n }else{\r\n n=o;\r\n }\r\n break;\r\n case RegExp:\r\n n = new c(o.valueOf());\r\n break;\r\n case Date:\r\n n = new c(o);\r\n break;\r\n case ArrayBuffer:\r\n n = new c((new Int8Array(o)).length);\r\n break;\r\n default:\r\n n = o;\r\n }\r\n keys = Object.keys(o);\r\n } else {\r\n n = {};\r\n keys = Object.getOwnPropertyNames(o);\r\n }\r\n for (let i of keys) n[i] = deepCopy(o[i]);\r\n }\r\n for (let i of Object.getOwnPropertySymbols(o)) n[i] = deepCopy(o[i]);\r\n return n;\r\n}\r\nfunction recursiveDeepCopy(obj) {\r\n return Object.keys(obj).reduce((v, d) =\u003E Object.assign(v, {\r\n [d]: (obj[d].constructor === Object) ? recursiveDeepCopy(obj[d]) : obj[d]\r\n }), {});\r\n}\r\n\r\nfunction recursiveDeepCopy_v2(o) {\r\n var newO, i;\r\n\r\n if (typeof o !== \u0027object\u0027) {\r\n return o;\r\n }\r\n if (!o) {\r\n return o;\r\n }\r\n\r\n if (\u0027[object Array]\u0027 === Object.prototype.toString.apply(o)) {\r\n newO = [];\r\n for (i = 0; i \u003C o.length; i \u002B= 1) {\r\n newO[i] = recursiveDeepCopy_v2(o[i]);\r\n }\r\n return newO;\r\n }\r\n\r\n newO = {};\r\n for (i in o) {\r\n if (o.hasOwnProperty(i)) {\r\n newO[i] = recursiveDeepCopy_v2(o[i]);\r\n }\r\n }\r\n return newO;\r\n}\r\n\r\nfunction jsonDeepCopy(o) {\r\n return JSON.parse(JSON.stringify(o));\r\n}\r\n\r\nvar dimensions = [{\r\n \u0022dimensions\u0022: [{\r\n \u0022runtime\u0022: {\r\n \u0022common\u0022: {\r\n \u0022client\u0022: null,\r\n \u0022server\u0022: null\r\n }\r\n }\r\n }, {\r\n \u0022device\u0022: {\r\n \u0022android\u0022: null,\r\n \u0022blackberry\u0022: null,\r\n \u0022iemobile\u0022: null,\r\n \u0022iphone\u0022: null,\r\n \u0022ipad\u0022: null,\r\n \u0022kindle\u0022: null,\r\n \u0022opera-mini\u0022: null,\r\n \u0022palm\u0022: null\r\n }\r\n }, {\r\n \u0022environment\u0022: {\r\n \u0022development\u0022: {\r\n \u0022dev\u0022: null,\r\n \u0022test\u0022: null\r\n },\r\n \u0022production\u0022: {\r\n \u0022stage\u0022: null,\r\n \u0022prod\u0022: null\r\n }\r\n }\r\n }, {\r\n \u0022lang\u0022: {\r\n \u0022ar\u0022: {\r\n \u0022ar-JO\u0022: null,\r\n \u0022ar-MA\u0022: null,\r\n \u0022ar-SA\u0022: null,\r\n \u0022ar-EG\u0022: null\r\n },\r\n \u0022bn\u0022: {\r\n \u0022bn-IN\u0022: null\r\n },\r\n \u0022ca\u0022: {\r\n \u0022ca-ES\u0022: null\r\n },\r\n \u0022cs\u0022: {\r\n \u0022cs-CZ\u0022: null\r\n },\r\n \u0022da\u0022: {\r\n \u0022da-DK\u0022: null\r\n },\r\n \u0022de\u0022: {\r\n \u0022de-AT\u0022: null,\r\n \u0022de-DE\u0022: null\r\n },\r\n \u0022el\u0022: {\r\n \u0022el-GR\u0022: null\r\n },\r\n \u0022en\u0022: {\r\n \u0022en-AU\u0022: null,\r\n \u0022en-BG\u0022: null,\r\n \u0022en-CA\u0022: null,\r\n \u0022en-GB\u0022: null,\r\n \u0022en-GY\u0022: null,\r\n \u0022en-HK\u0022: null,\r\n \u0022en-IE\u0022: null,\r\n \u0022en-IN\u0022: null,\r\n \u0022en-MY\u0022: null,\r\n \u0022en-NZ\u0022: null,\r\n \u0022en-PH\u0022: null,\r\n \u0022en-SG\u0022: null,\r\n \u0022en-US\u0022: null,\r\n \u0022en-ZA\u0022: null\r\n },\r\n \u0022es\u0022: {\r\n \u0022es-AR\u0022: null,\r\n \u0022es-BO\u0022: null,\r\n \u0022es-CL\u0022: null,\r\n \u0022es-CO\u0022: null,\r\n \u0022es-EC\u0022: null,\r\n \u0022es-ES\u0022: null,\r\n \u0022es-MX\u0022: null,\r\n \u0022es-PE\u0022: null,\r\n \u0022es-PY\u0022: null,\r\n \u0022es-US\u0022: null,\r\n \u0022es-UY\u0022: null,\r\n \u0022es-VE\u0022: null\r\n },\r\n \u0022fi\u0022: {\r\n \u0022fi-FI\u0022: null\r\n },\r\n \u0022fr\u0022: {\r\n \u0022fr-BE\u0022: null,\r\n \u0022fr-CA\u0022: null,\r\n \u0022fr-FR\u0022: null,\r\n \u0022fr-GF\u0022: null\r\n },\r\n \u0022hi\u0022: {\r\n \u0022hi-IN\u0022: null\r\n },\r\n \u0022hu\u0022: {\r\n \u0022hu-HU\u0022: null\r\n },\r\n \u0022id\u0022: {\r\n \u0022id-ID\u0022: null\r\n },\r\n \u0022it\u0022: {\r\n \u0022it-IT\u0022: null\r\n },\r\n \u0022ja\u0022: {\r\n \u0022ja-JP\u0022: null\r\n },\r\n \u0022kn\u0022: {\r\n \u0022kn-IN\u0022: null\r\n },\r\n \u0022ko\u0022: {\r\n \u0022ko-KR\u0022: null\r\n },\r\n \u0022ml\u0022: {\r\n \u0022ml-IN\u0022: null\r\n },\r\n \u0022mr\u0022: {\r\n \u0022mr-IN\u0022: null\r\n },\r\n \u0022ms\u0022: {\r\n \u0022ms-MY\u0022: null\r\n },\r\n \u0022nb\u0022: {\r\n \u0022nb-NO\u0022: null\r\n },\r\n \u0022nl\u0022: {\r\n \u0022nl-BE\u0022: null,\r\n \u0022nl-NL\u0022: null,\r\n \u0022nl-SR\u0022: null\r\n },\r\n \u0022pl\u0022: {\r\n \u0022pl-PL\u0022: null\r\n },\r\n \u0022pt\u0022: {\r\n \u0022pt-BR\u0022: null\r\n },\r\n \u0022ro\u0022: {\r\n \u0022ro-RO\u0022: null\r\n },\r\n \u0022ru\u0022: {\r\n \u0022ru-RU\u0022: null\r\n },\r\n \u0022sv\u0022: {\r\n \u0022sv-SE\u0022: null\r\n },\r\n \u0022ta\u0022: {\r\n \u0022ta-IN\u0022: null\r\n },\r\n \u0022te\u0022: {\r\n \u0022te-IN\u0022: null\r\n },\r\n \u0022th\u0022: {\r\n \u0022th-TH\u0022: null\r\n },\r\n \u0022tr\u0022: {\r\n \u0022tr-TR\u0022: null\r\n },\r\n \u0022vi\u0022: {\r\n \u0022vi-VN\u0022: null\r\n },\r\n \u0022zh\u0022: {\r\n \u0022zh-Hans\u0022: {\r\n \u0022zh-Hans-CN\u0022: null\r\n },\r\n \u0022zh-Hant\u0022: {\r\n \u0022zh-Hant-HK\u0022: null,\r\n \u0022zh-Hant-TW\u0022: null\r\n }\r\n }\r\n }\r\n }]\r\n}]\r\n","TestCases":[{"Name":"Recursive Deep Copy","Code":"var dimensionsCopy = recursiveDeepCopy(dimensions);","IsDeferred":false},{"Name":"JSON Deep Copy","Code":"var dimensionsCopy = jsonDeepCopy(dimensions);","IsDeferred":false},{"Name":"lodash clone","Code":"var dimensionsCopy = _.cloneDeep(dimensions);","IsDeferred":false},{"Name":"c7x43t","Code":"var dimensionsCopy = deepCopy(dimensions);","IsDeferred":false},{"Name":"recursiveDeepCopy_v2","Code":"var dimensionsCopy = recursiveDeepCopy_v2(dimensions);","IsDeferred":false}]}