{"ScriptPreparationCode":"var MyObject = [\r\n {\r\n \u0022_id\u0022: \u00225e1e19a37db52f9e9d93e658\u0022,\r\n \u0022index\u0022: 0,\r\n \u0022guid\u0022: \u0022396e60ae-845d-4503-b494-2a0ccd1df9f2\u0022,\r\n \u0022isActive\u0022: false,\r\n \u0022balance\u0022: \u0022$1,389.79\u0022,\r\n \u0022picture\u0022: \u0022http://placehold.it/32x32\u0022,\r\n \u0022age\u0022: 26,\r\n \u0022eyeColor\u0022: \u0022green\u0022,\r\n \u0022name\u0022: \u0022Josie Head\u0022,\r\n \u0022gender\u0022: \u0022female\u0022,\r\n \u0022company\u0022: \u0022FITCORE\u0022,\r\n \u0022email\u0022: \u0022josiehead@fitcore.com\u0022,\r\n \u0022phone\u0022: \u0022\u002B1 (960) 535-2795\u0022,\r\n \u0022address\u0022: \u0022846 Regent Place, Twilight, Missouri, 5131\u0022,\r\n \u0022about\u0022: \u0022Duis adipisicing commodo reprehenderit veniam cillum nostrud sit sunt est. Tempor laborum pariatur irure nulla ex reprehenderit. Voluptate anim eu et nostrud ipsum mollit aute qui ea ullamco. Nulla minim sint voluptate exercitation nostrud mollit eu mollit. Ea duis dolor quis enim consectetur. Veniam cillum exercitation incididunt reprehenderit.\\r\\n\u0022,\r\n \u0022registered\u0022: \u00222019-01-06T08:54:40 \u002B05:00\u0022,\r\n \u0022latitude\u0022: -80.487714,\r\n \u0022longitude\u0022: 78.798071,\r\n \u0022tags\u0022: [\r\n \u0022minim\u0022,\r\n \u0022irure\u0022,\r\n \u0022dolor\u0022,\r\n \u0022commodo\u0022,\r\n \u0022magna\u0022,\r\n \u0022excepteur\u0022,\r\n \u0022magna\u0022\r\n ],\r\n \u0022friends\u0022: [\r\n {\r\n \u0022id\u0022: 0,\r\n \u0022name\u0022: \u0022Odom Grant\u0022\r\n },\r\n {\r\n \u0022id\u0022: 1,\r\n \u0022name\u0022: \u0022Hester Caldwell\u0022\r\n },\r\n {\r\n \u0022id\u0022: 2,\r\n \u0022name\u0022: \u0022Clements Bullock\u0022\r\n }\r\n ],\r\n \u0022greeting\u0022: \u0022Hello, Josie Head! You have 3 unread messages.\u0022,\r\n \u0022favoriteFruit\u0022: \u0022apple\u0022\r\n },\r\n {\r\n \u0022_id\u0022: \u00225e1e19a38ad96c2c356f4bfb\u0022,\r\n \u0022index\u0022: 1,\r\n \u0022guid\u0022: \u00224786ea00-8742-439f-8e2a-004a2bae8a84\u0022,\r\n \u0022isActive\u0022: true,\r\n \u0022balance\u0022: \u0022$2,048.19\u0022,\r\n \u0022picture\u0022: \u0022http://placehold.it/32x32\u0022,\r\n \u0022age\u0022: 26,\r\n \u0022eyeColor\u0022: \u0022blue\u0022,\r\n \u0022name\u0022: \u0022Julie Kemp\u0022,\r\n \u0022gender\u0022: \u0022female\u0022,\r\n \u0022company\u0022: \u0022FUELWORKS\u0022,\r\n \u0022email\u0022: \u0022juliekemp@fuelworks.com\u0022,\r\n \u0022phone\u0022: \u0022\u002B1 (886) 498-3935\u0022,\r\n \u0022address\u0022: \u0022152 Middleton Street, Celeryville, Ohio, 9868\u0022,\r\n \u0022about\u0022: \u0022Dolore eu do laborum irure amet nulla deserunt sunt ex et voluptate aute reprehenderit irure. Ullamco tempor aute sunt dolore nulla consequat esse est occaecat sunt non. Reprehenderit esse aute Lorem aliquip elit fugiat incididunt mollit sint qui dolore incididunt mollit. Aliquip ad mollit anim proident ipsum irure. Elit ullamco est eu sunt nostrud aliquip laboris sint reprehenderit. Aliquip anim eiusmod officia duis dolor voluptate duis nisi.\\r\\n\u0022,\r\n \u0022registered\u0022: \u00222018-08-12T10:46:50 \u002B04:00\u0022,\r\n \u0022latitude\u0022: -3.524966,\r\n \u0022longitude\u0022: -156.077579,\r\n \u0022tags\u0022: [\r\n \u0022minim\u0022,\r\n \u0022est\u0022,\r\n \u0022Lorem\u0022,\r\n \u0022nostrud\u0022,\r\n \u0022enim\u0022,\r\n \u0022non\u0022,\r\n \u0022ea\u0022\r\n ],\r\n \u0022friends\u0022: [\r\n {\r\n \u0022id\u0022: 0,\r\n \u0022name\u0022: \u0022Barr Scott\u0022\r\n },\r\n {\r\n \u0022id\u0022: 1,\r\n \u0022name\u0022: \u0022Atkinson Avery\u0022\r\n },\r\n {\r\n \u0022id\u0022: 2,\r\n \u0022name\u0022: \u0022Teri Rivera\u0022\r\n }\r\n ],\r\n \u0022greeting\u0022: \u0022Hello, Julie Kemp! You have 6 unread messages.\u0022,\r\n \u0022favoriteFruit\u0022: \u0022apple\u0022\r\n },\r\n {\r\n \u0022_id\u0022: \u00225e1e19a343953743072e48c9\u0022,\r\n \u0022index\u0022: 2,\r\n \u0022guid\u0022: \u0022f0b3b8a2-6383-4cfa-a95e-439d3e360592\u0022,\r\n \u0022isActive\u0022: true,\r\n \u0022balance\u0022: \u0022$1,305.41\u0022,\r\n \u0022picture\u0022: \u0022http://placehold.it/32x32\u0022,\r\n \u0022age\u0022: 34,\r\n \u0022eyeColor\u0022: \u0022green\u0022,\r\n \u0022name\u0022: \u0022Herman Griffith\u0022,\r\n \u0022gender\u0022: \u0022male\u0022,\r\n \u0022company\u0022: \u0022OPTICOM\u0022,\r\n \u0022email\u0022: \u0022hermangriffith@opticom.com\u0022,\r\n \u0022phone\u0022: \u0022\u002B1 (922) 507-3579\u0022,\r\n \u0022address\u0022: \u0022314 Dekalb Avenue, Dixie, Minnesota, 2312\u0022,\r\n \u0022about\u0022: \u0022Anim mollit esse adipisicing et consectetur proident. Ut minim tempor consectetur aute eiusmod eu. Aliquip do esse pariatur aliqua non cillum. Magna sint laboris reprehenderit duis et id eu velit.\\r\\n\u0022,\r\n \u0022registered\u0022: \u00222018-06-12T09:35:46 \u002B04:00\u0022,\r\n \u0022latitude\u0022: -30.773629,\r\n \u0022longitude\u0022: -47.060717,\r\n \u0022tags\u0022: [\r\n \u0022aute\u0022,\r\n \u0022pariatur\u0022,\r\n \u0022deserunt\u0022,\r\n \u0022et\u0022,\r\n \u0022cillum\u0022,\r\n \u0022id\u0022,\r\n \u0022excepteur\u0022\r\n ],\r\n \u0022friends\u0022: [\r\n {\r\n \u0022id\u0022: 0,\r\n \u0022name\u0022: \u0022Mack David\u0022\r\n },\r\n {\r\n \u0022id\u0022: 1,\r\n \u0022name\u0022: \u0022Joanne Bryan\u0022\r\n },\r\n {\r\n \u0022id\u0022: 2,\r\n \u0022name\u0022: \u0022Carroll Allen\u0022\r\n }\r\n ],\r\n \u0022greeting\u0022: \u0022Hello, Herman Griffith! You have 6 unread messages.\u0022,\r\n \u0022favoriteFruit\u0022: \u0022apple\u0022\r\n },\r\n {\r\n \u0022_id\u0022: \u00225e1e19a344109f0176249156\u0022,\r\n \u0022index\u0022: 3,\r\n \u0022guid\u0022: \u00228d123a89-ac66-40ee-9d1d-3e34d12a66c5\u0022,\r\n \u0022isActive\u0022: true,\r\n \u0022balance\u0022: \u0022$1,877.60\u0022,\r\n \u0022picture\u0022: \u0022http://placehold.it/32x32\u0022,\r\n \u0022age\u0022: 22,\r\n \u0022eyeColor\u0022: \u0022blue\u0022,\r\n \u0022name\u0022: \u0022Best Bruce\u0022,\r\n \u0022gender\u0022: \u0022male\u0022,\r\n \u0022company\u0022: \u0022MAINELAND\u0022,\r\n \u0022email\u0022: \u0022bestbruce@maineland.com\u0022,\r\n \u0022phone\u0022: \u0022\u002B1 (835) 553-3427\u0022,\r\n \u0022address\u0022: \u0022247 Cumberland Street, Volta, Rhode Island, 6571\u0022,\r\n \u0022about\u0022: \u0022Fugiat velit id veniam ut culpa aliqua dolore excepteur fugiat fugiat Lorem irure. Consectetur anim pariatur eu irure et. Elit anim voluptate magna ut minim labore. Occaecat qui pariatur ea quis Lorem consectetur aute labore aliqua ut aute irure sunt. Tempor eu pariatur sint excepteur exercitation aliqua aliquip proident deserunt. Incididunt dolore proident est ex ipsum.\\r\\n\u0022,\r\n \u0022registered\u0022: \u00222016-09-03T02:40:47 \u002B04:00\u0022,\r\n \u0022latitude\u0022: -86.651356,\r\n \u0022longitude\u0022: -72.364284,\r\n \u0022tags\u0022: [\r\n \u0022exercitation\u0022,\r\n \u0022dolor\u0022,\r\n \u0022duis\u0022,\r\n \u0022tempor\u0022,\r\n \u0022ea\u0022,\r\n \u0022ut\u0022,\r\n \u0022enim\u0022\r\n ],\r\n \u0022friends\u0022: [\r\n {\r\n \u0022id\u0022: 0,\r\n \u0022name\u0022: \u0022Bolton Peters\u0022\r\n },\r\n {\r\n \u0022id\u0022: 1,\r\n \u0022name\u0022: \u0022Lucinda Franklin\u0022\r\n },\r\n {\r\n \u0022id\u0022: 2,\r\n \u0022name\u0022: \u0022Humphrey Gentry\u0022\r\n }\r\n ],\r\n \u0022greeting\u0022: \u0022Hello, Best Bruce! You have 4 unread messages.\u0022,\r\n \u0022favoriteFruit\u0022: \u0022strawberry\u0022\r\n },\r\n {\r\n \u0022_id\u0022: \u00225e1e19a3ebc39ce616e60e71\u0022,\r\n \u0022index\u0022: 4,\r\n \u0022guid\u0022: \u0022c97a8bf9-f1d5-4d3a-9a82-1470ddb80863\u0022,\r\n \u0022isActive\u0022: true,\r\n \u0022balance\u0022: \u0022$2,794.32\u0022,\r\n \u0022picture\u0022: \u0022http://placehold.it/32x32\u0022,\r\n \u0022age\u0022: 21,\r\n \u0022eyeColor\u0022: \u0022green\u0022,\r\n \u0022name\u0022: \u0022Young Frederick\u0022,\r\n \u0022gender\u0022: \u0022female\u0022,\r\n \u0022company\u0022: \u0022MATRIXITY\u0022,\r\n \u0022email\u0022: \u0022youngfrederick@matrixity.com\u0022,\r\n \u0022phone\u0022: \u0022\u002B1 (899) 577-2643\u0022,\r\n \u0022address\u0022: \u0022405 Bay Street, Harold, New York, 2507\u0022,\r\n \u0022about\u0022: \u0022Ea labore dolor est pariatur consectetur aute qui cillum voluptate. Lorem voluptate mollit consectetur in elit reprehenderit. In elit magna Lorem dolore nostrud ut in ad pariatur id. Nisi eiusmod pariatur ut labore. Anim elit do excepteur ex mollit ad labore excepteur aliquip. Ipsum cillum mollit aute ad elit esse esse et eu anim veniam.\\r\\n\u0022,\r\n \u0022registered\u0022: \u00222017-04-26T12:04:12 \u002B04:00\u0022,\r\n \u0022latitude\u0022: -6.274446,\r\n \u0022longitude\u0022: -177.658413,\r\n \u0022tags\u0022: [\r\n \u0022sit\u0022,\r\n \u0022sunt\u0022,\r\n \u0022pariatur\u0022,\r\n \u0022commodo\u0022,\r\n \u0022adipisicing\u0022,\r\n \u0022non\u0022,\r\n \u0022enim\u0022\r\n ],\r\n \u0022friends\u0022: [\r\n {\r\n \u0022id\u0022: 0,\r\n \u0022name\u0022: \u0022Latasha Mclean\u0022\r\n },\r\n {\r\n \u0022id\u0022: 1,\r\n \u0022name\u0022: \u0022Dillard Barrera\u0022\r\n },\r\n {\r\n \u0022id\u0022: 2,\r\n \u0022name\u0022: \u0022Roth Acevedo\u0022\r\n }\r\n ],\r\n \u0022greeting\u0022: \u0022Hello, Young Frederick! You have 5 unread messages.\u0022,\r\n \u0022favoriteFruit\u0022: \u0022strawberry\u0022\r\n },\r\n {\r\n \u0022_id\u0022: \u00225e1e19a3f36e5a3ff58c3f1e\u0022,\r\n \u0022index\u0022: 5,\r\n \u0022guid\u0022: \u00222c41264a-f19e-4fa5-91d7-ca8cf5314b0a\u0022,\r\n \u0022isActive\u0022: true,\r\n \u0022balance\u0022: \u0022$2,323.64\u0022,\r\n \u0022picture\u0022: \u0022http://placehold.it/32x32\u0022,\r\n \u0022age\u0022: 22,\r\n \u0022eyeColor\u0022: \u0022blue\u0022,\r\n \u0022name\u0022: \u0022Cotton Warner\u0022,\r\n \u0022gender\u0022: \u0022male\u0022,\r\n \u0022company\u0022: \u0022EQUITAX\u0022,\r\n \u0022email\u0022: \u0022cottonwarner@equitax.com\u0022,\r\n \u0022phone\u0022: \u0022\u002B1 (871) 439-2340\u0022,\r\n \u0022address\u0022: \u0022517 Madoc Avenue, Chloride, Utah, 9942\u0022,\r\n \u0022about\u0022: \u0022Aute esse adipisicing fugiat sunt. Ullamco est officia ex quis fugiat nostrud Lorem consectetur minim aliqua incididunt tempor dolore. Anim duis consectetur commodo Lorem proident id elit reprehenderit velit mollit aute non elit est. Tempor do occaecat officia est fugiat qui laborum ad do magna.\\r\\n\u0022,\r\n \u0022registered\u0022: \u00222018-10-20T10:42:15 \u002B04:00\u0022,\r\n \u0022latitude\u0022: 47.224342,\r\n \u0022longitude\u0022: 84.61698,\r\n \u0022tags\u0022: [\r\n \u0022mollit\u0022,\r\n \u0022fugiat\u0022,\r\n \u0022sint\u0022,\r\n \u0022nisi\u0022,\r\n \u0022sit\u0022,\r\n \u0022aliquip\u0022,\r\n \u0022deserunt\u0022\r\n ],\r\n \u0022friends\u0022: [\r\n {\r\n \u0022id\u0022: 0,\r\n \u0022name\u0022: \u0022Jodi Long\u0022\r\n },\r\n {\r\n \u0022id\u0022: 1,\r\n \u0022name\u0022: \u0022Jenifer Willis\u0022\r\n },\r\n {\r\n \u0022id\u0022: 2,\r\n \u0022name\u0022: \u0022Kirsten Roberts\u0022\r\n }\r\n ],\r\n \u0022greeting\u0022: \u0022Hello, Cotton Warner! You have 6 unread messages.\u0022,\r\n \u0022favoriteFruit\u0022: \u0022banana\u0022\r\n },\r\n {\r\n \u0022_id\u0022: \u00225e1e19a358fd18301abe8d8d\u0022,\r\n \u0022index\u0022: 6,\r\n \u0022guid\u0022: \u00228a590918-c40e-4291-8e16-5919c01ce395\u0022,\r\n \u0022isActive\u0022: false,\r\n \u0022balance\u0022: \u0022$1,809.92\u0022,\r\n \u0022picture\u0022: \u0022http://placehold.it/32x32\u0022,\r\n \u0022age\u0022: 33,\r\n \u0022eyeColor\u0022: \u0022green\u0022,\r\n \u0022name\u0022: \u0022Margo Nash\u0022,\r\n \u0022gender\u0022: \u0022female\u0022,\r\n \u0022company\u0022: \u0022FROLIX\u0022,\r\n \u0022email\u0022: \u0022margonash@frolix.com\u0022,\r\n \u0022phone\u0022: \u0022\u002B1 (889) 407-3670\u0022,\r\n \u0022address\u0022: \u0022916 Colonial Road, Belfair, Connecticut, 1956\u0022,\r\n \u0022about\u0022: \u0022Amet ullamco aliqua occaecat nulla laborum incididunt minim nostrud sint. Eiusmod ut labore adipisicing commodo consectetur. Id cupidatat proident officia do. Aute nostrud sit pariatur irure consequat esse enim magna nisi. Magna ad cupidatat cupidatat amet nisi incididunt quis enim in aliquip ut velit sint aliquip.\\r\\n\u0022,\r\n \u0022registered\u0022: \u00222015-06-08T03:26:01 \u002B04:00\u0022,\r\n \u0022latitude\u0022: -69.241111,\r\n \u0022longitude\u0022: -40.43834,\r\n \u0022tags\u0022: [\r\n \u0022ullamco\u0022,\r\n \u0022commodo\u0022,\r\n \u0022deserunt\u0022,\r\n \u0022sint\u0022,\r\n \u0022consectetur\u0022,\r\n \u0022pariatur\u0022,\r\n \u0022ullamco\u0022\r\n ],\r\n \u0022friends\u0022: [\r\n {\r\n \u0022id\u0022: 0,\r\n \u0022name\u0022: \u0022Malinda Lang\u0022\r\n },\r\n {\r\n \u0022id\u0022: 1,\r\n \u0022name\u0022: \u0022Jeanie Rivers\u0022\r\n },\r\n {\r\n \u0022id\u0022: 2,\r\n \u0022name\u0022: \u0022Greene Wilkerson\u0022\r\n }\r\n ],\r\n \u0022greeting\u0022: \u0022Hello, Margo Nash! You have 6 unread messages.\u0022,\r\n \u0022favoriteFruit\u0022: \u0022banana\u0022\r\n }\r\n];\r\n\r\nvar myCopy = null;\r\n","TestCases":[{"Name":"Lodash cloneDeep","Code":"myCopy = _.cloneDeep(MyObject);","IsDeferred":false},{"Name":"Json clone","Code":"myCopy = JSON.parse(JSON.stringify(MyObject));","IsDeferred":false},{"Name":"Ramda clone","Code":"myCopy = R.clone(MyObject);","IsDeferred":false},{"Name":"hand rolled","Code":"const cp=(obj)=\u003E\u0022object\u0022 === typeof obj ? Object.fromEntries(Object.entries(obj).map(([k,v])=\u003E[k,cp(v)])) : obj\r\n\r\nmyCopy = cp(MyObject)","IsDeferred":false},{"Name":"loop not map (still recursive)","Code":"const cp_old=(obj)=\u003E{\r\n if (\u0022object\u0022 !== typeof obj) {\r\n return obj\r\n } else {\r\n const entries = Object.entries(obj)\r\n for(let i = 0; i \u003C entries.length; i\u002B\u002B) {\r\n entries[i][2] = cp_old(entries[i][2])\r\n }\r\n return Object.fromEntries(entries)\r\n }\r\n}\r\nmyCopy = cp_old(MyObject)","IsDeferred":false},{"Name":"original gangster","Code":"const cp_stack=(obj)=\u003E{\r\n if (\u0022object\u0022 !== typeof obj) {\r\n return obj\r\n } else {\r\n const stack = []\r\n let entries = Object.entries(obj)\r\n let i=0\r\n stackloop: while(true) {\r\n \tfor(; i \u003C entries.length; i\u002B\u002B) {\r\n if (\u0022object\u0022 !== typeof entries[i][2]) continue\r\n \r\n stack.push([i,entries])\r\n entries = Object.entries(entries[i][2])\r\n i = 0\r\n continue stackloop\r\n \t}\r\n if (stack.length === 0) break\r\n const copy = Object.fromEntries(entries)\r\n [i, entries] = stack.pop()\r\n entries[i][2] = copy\r\n }\r\n return Object.fromEntries(entries)\r\n }\r\n}\r\nmyCopy = cp_stack(MyObject)","IsDeferred":false}]}