{"ScriptPreparationCode":null,"TestCases":[{"Name":"JSON.parse(JSON.stringify())","Code":"const base = {\r\n\tfirstName: \u0027John\u0027,\r\n lastName: \u0027Doe\u0027,\r\n size: 170,\r\n birthDate: new Date(1985, 0,15),\r\n married: true,\r\n address: {\r\n \tstreet: \u00272 av Victor Hugo\u0027,\r\n country: \u0027FR\u0027,\r\n },\r\n childrens: [\r\n \t{\r\n \tname: \u0027Paul\u0027,\r\n age: 8,\r\n },\r\n ],\r\n functions: [\r\n \tfunction () { return \u0027Base function\u0027 },\r\n ],\r\n};\r\nconst copy = JSON.parse(JSON.stringify(base));","IsDeferred":false},{"Name":"Custom function","Code":"function clone(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) ? clone(value) : value;\r\n }\r\n\r\n return bObject;\r\n};\r\n// base object\r\nconst base = {\r\n\tfirstName: \u0027John\u0027,\r\n lastName: \u0027Doe\u0027,\r\n size: 170,\r\n birthDate: new Date(1985, 0,15),\r\n married: true,\r\n address: {\r\n \tstreet: \u00272 av Victor Hugo\u0027,\r\n country: \u0027FR\u0027,\r\n },\r\n childrens: [\r\n \t{\r\n \tname: \u0027Paul\u0027,\r\n age: 8,\r\n },\r\n ],\r\n functions: [\r\n \tfunction () { return \u0027Base function\u0027 },\r\n ],\r\n};\r\nconst copy = clone(base);","IsDeferred":false},{"Name":"Lodash.cloneDeep()","Code":"const base = {\r\n\tfirstName: \u0027John\u0027,\r\n lastName: \u0027Doe\u0027,\r\n size: 170,\r\n birthDate: new Date(1985, 0,15),\r\n married: true,\r\n address: {\r\n \tstreet: \u00272 av Victor Hugo\u0027,\r\n country: \u0027FR\u0027,\r\n },\r\n childrens: [\r\n \t{\r\n \tname: \u0027Paul\u0027,\r\n age: 8,\r\n },\r\n ],\r\n functions: [\r\n \tfunction () { return \u0027Base function\u0027 },\r\n ],\r\n};\r\nconst copy = _.cloneDeep(base);","IsDeferred":false},{"Name":"jQuery.extend(true)","Code":"const base = {\r\n\tfirstName: \u0027John\u0027,\r\n lastName: \u0027Doe\u0027,\r\n size: 170,\r\n birthDate: new Date(1985, 0,15),\r\n married: true,\r\n address: {\r\n \tstreet: \u00272 av Victor Hugo\u0027,\r\n country: \u0027FR\u0027,\r\n },\r\n childrens: [\r\n \t{\r\n \tname: \u0027Paul\u0027,\r\n age: 8,\r\n },\r\n ],\r\n functions: [\r\n \tfunction () { return \u0027Base function\u0027 },\r\n ],\r\n};\r\nconst copy = jQuery.extend(true, {}, base);","IsDeferred":false}]}