{"ScriptPreparationCode":null,"TestCases":[{"Name":"Spread operator (...)","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 otherObjs: {\r\n \tmySet: new Set([\u0022a\u0022,\u0022b\u0022,\u0022c\u0022]),\r\n myMap: new Map([[\u0022apples\u0022, 500],[\u0022bananas\u0022, 300],[\u0022oranges\u0022, 200]]),\r\n myErr: new Error(\u0022Oups !\u0022),\r\n myReg: new RegExp(/ab\u002Bc/, \u0022i\u0022),\r\n myBlob: new Blob([\u0022\u003Chtml\u003E\u2026\u003C/html\u003E\u0022], {type: \u0027text/html\u0027}),\r\n myFile: new File([\u0022\u0022], \u0022filename\u0022),\r\n myArrBuff: new ArrayBuffer(8),\r\n myImgData: new ImageData(300, 300),\r\n },\r\n}\r\nconst copy = { ...base };","IsDeferred":false},{"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 otherObjs: {\r\n \tmySet: new Set([\u0022a\u0022,\u0022b\u0022,\u0022c\u0022]),\r\n myMap: new Map([[\u0022apples\u0022, 500],[\u0022bananas\u0022, 300],[\u0022oranges\u0022, 200]]),\r\n myErr: new Error(\u0022Oups !\u0022),\r\n myReg: new RegExp(/ab\u002Bc/, \u0022i\u0022),\r\n myBlob: new Blob([\u0022\u003Chtml\u003E\u2026\u003C/html\u003E\u0022], {type: \u0027text/html\u0027}),\r\n myFile: new File([\u0022\u0022], \u0022filename\u0022),\r\n myArrBuff: new ArrayBuffer(8),\r\n myImgData: new ImageData(300, 300),\r\n },\r\n}\r\nconst copy = JSON.parse(JSON.stringify(base));","IsDeferred":false},{"Name":"Custom function","Code":"function myClone(aObject) {\r\n // Prevent undefined objects\r\n // if (!aObject) return aObject;\r\n let bObject = Array.isArray(aObject) ? [] : {};\r\n let value;\r\n for (const key in aObject) {\r\n // Prevent self-references to parent object\r\n // if (Object.is(aObject[key], aObject)) continue;\r\n value = aObject[key];\r\n bObject[key] = (typeof value === \u0022object\u0022) ? myClone(value) : value;\r\n }\r\n return bObject;\r\n};\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 otherObjs: {\r\n \tmySet: new Set([\u0022a\u0022,\u0022b\u0022,\u0022c\u0022]),\r\n myMap: new Map([[\u0022apples\u0022, 500],[\u0022bananas\u0022, 300],[\u0022oranges\u0022, 200]]),\r\n myErr: new Error(\u0022Oups !\u0022),\r\n myReg: new RegExp(/ab\u002Bc/, \u0022i\u0022),\r\n myBlob: new Blob([\u0022\u003Chtml\u003E\u2026\u003C/html\u003E\u0022], {type: \u0027text/html\u0027}),\r\n myFile: new File([\u0022\u0022], \u0022filename\u0022),\r\n myArrBuff: new ArrayBuffer(8),\r\n myImgData: new ImageData(300, 300),\r\n },\r\n}\r\nconst copy = myClone(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 otherObjs: {\r\n \tmySet: new Set([\u0022a\u0022,\u0022b\u0022,\u0022c\u0022]),\r\n myMap: new Map([[\u0022apples\u0022, 500],[\u0022bananas\u0022, 300],[\u0022oranges\u0022, 200]]),\r\n myErr: new Error(\u0022Oups !\u0022),\r\n myReg: new RegExp(/ab\u002Bc/, \u0022i\u0022),\r\n myBlob: new Blob([\u0022\u003Chtml\u003E\u2026\u003C/html\u003E\u0022], {type: \u0027text/html\u0027}),\r\n myFile: new File([\u0022\u0022], \u0022filename\u0022),\r\n myArrBuff: new ArrayBuffer(8),\r\n myImgData: new ImageData(300, 300),\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 otherObjs: {\r\n \tmySet: new Set([\u0022a\u0022,\u0022b\u0022,\u0022c\u0022]),\r\n myMap: new Map([[\u0022apples\u0022, 500],[\u0022bananas\u0022, 300],[\u0022oranges\u0022, 200]]),\r\n myErr: new Error(\u0022Oups !\u0022),\r\n myReg: new RegExp(/ab\u002Bc/, \u0022i\u0022),\r\n myBlob: new Blob([\u0022\u003Chtml\u003E\u2026\u003C/html\u003E\u0022], {type: \u0027text/html\u0027}),\r\n myFile: new File([\u0022\u0022], \u0022filename\u0022),\r\n myArrBuff: new ArrayBuffer(8),\r\n myImgData: new ImageData(300, 300),\r\n },\r\n}\r\nconst copy = jQuery.extend(true, {}, base);","IsDeferred":false},{"Name":"structuredClone()","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 otherObjs: {\r\n \tmySet: new Set([\u0022a\u0022,\u0022b\u0022,\u0022c\u0022]),\r\n myMap: new Map([[\u0022apples\u0022, 500],[\u0022bananas\u0022, 300],[\u0022oranges\u0022, 200]]),\r\n myErr: new Error(\u0022Oups !\u0022),\r\n myReg: new RegExp(/ab\u002Bc/, \u0022i\u0022),\r\n myBlob: new Blob([\u0022\u003Chtml\u003E\u2026\u003C/html\u003E\u0022], {type: \u0027text/html\u0027}),\r\n myFile: new File([\u0022\u0022], \u0022filename\u0022),\r\n myArrBuff: new ArrayBuffer(8),\r\n myImgData: new ImageData(300, 300),\r\n },\r\n}\r\nconst copy = structuredClone(base);","IsDeferred":false}]}