Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash cloneDeep vs structuredClone vs recursiveDeepCopy vs JSON clone (larger object)
https://developer.mozilla.org/en-US/docs/Web/API/structuredClone
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
recursiveDeepCopy
8K/s
Json Clone
8K/s
Native structuredClone
6K/s
Lodash cloneDeep
5K/s
View exact numbers
Test name
Executions per second
✓
recursiveDeepCopy
8,222 Ops/sec
Json Clone
8,135 Ops/sec
Native structuredClone
6,429 Ops/sec
Lodash cloneDeep
4,741 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
// Real world object containing data from a WYSIWYG data viz editor // Still no functions or complex data, purely JSON var MyLargerObject = { "uid": "spw6-xggz", "title": "print story", "description": "", "dataSource": { "datasetUid": "niqh-ewd6" }, "theme": "serif", "layout": "expanded", "blocks": [ { "layout": "12", "components": [ { "type": "globalFilter", "value": { "dataset": { "datasetUid": "niqh-ewd6", "parameterOverrides": {} }, "filters": [ { "function": "noop", "isHidden": false, "arguments": null, "columnName": "snow", "isDrilldown": false } ] }, "layout": { "h": 4, "w": 12, "x": 0, "y": 0, "maxH": 4, "maxW": 12, "minH": 4, "minW": 12, "static": "true" } } ], "presentable": true, "background_color": null }, { "layout": "12", "components": [ { "type": "html", "value": "<div><i>This is placeholder text. To get started, remove it and input your own information!</i> Or you could just leave this bit of text right here to experiment with the design and layout of your story. Go ahead, add another! Using a variety of layouts and visual arrangements will make your story stand out. Or that's what we like to think. This explains why we have all of these content blocks for you to play with. So get after it, author! Tell your story. It's going to be magnificent!d<br></div>", "layout": { "h": 15, "i": "clientSideId_2-block-item-index-0", "w": 4, "x": 0, "y": 0, "minW": 2, "moved": false, "static": false } }, { "type": "socrata.visualization.agTable", "value": { "vif": { "title": "", "format": { "type": "visualization_interchange_format", "version": 4 }, "series": [ { "type": "agTable", "unit": { "one": "row", "other": "rows" }, "color": {}, "label": null, "dataSource": { "type": "socrata.soql", "filters": [], "measure": { "columnName": null, "aggregationFunction": "count" }, "dimension": { "columns": [ { "id": 43302990, "name": "STATION", "format": {}, "position": 1, "fieldName": "station", "description": "", "dataTypeName": "text", "tableColumnId": 32230044, "cachedContents": { "top": [ { "item": "USW00024233", "count": "27223" } ], "null": "0", "count": "27223", "largest": "USW00024233", "non_null": "27223", "smallest": "USW00024233", "cardinality": "1" }, "renderTypeName": "text" }, { "id": 43302991, "name": "NAME", "format": {}, "position": 2, "fieldName": "name", "description": "", "dataTypeName": "text", "tableColumnId": 32230045, "cachedContents": { "top": [ { "item": "SEATTLE TACOMA AIRPORT, WA US", "count": "27223" } ], "null": "0", "count": "27223", "largest": "SEATTLE TACOMA AIRPORT, WA US", "non_null": "27223", "smallest": "SEATTLE TACOMA AIRPORT, WA US", "cardinality": "1" }, "renderTypeName": "text" }, { "id": 43302992, "name": "DATE", "format": {}, "position": 3, "fieldName": "date", "description": "", "dataTypeName": "calendar_date", "tableColumnId": 32230046, "cachedContents": { "top": [ { "item": "1948-02-29T00:00:00.000", "count": "1" }, { "item": "1948-03-01T00:00:00.000", "count": "1" }, { "item": "1948-03-02T00:00:00.000", "count": "1" }, { "item": "1948-03-03T00:00:00.000", "count": "1" }, { "item": "1948-03-04T00:00:00.000", "count": "1" }, { "item": "1948-03-05T00:00:00.000", "count": "1" }, { "item": "1948-03-06T00:00:00.000", "count": "1" }, { "item": "1948-03-07T00:00:00.000", "count": "1" }, { "item": "1948-03-08T00:00:00.000", "count": "1" }, { "item": "1948-03-09T00:00:00.000", "count": "1" }, { "item": "1948-03-10T00:00:00.000", "count": "1" }, { "item": "1948-03-11T00:00:00.000", "count": "1" }, { "item": "1948-03-12T00:00:00.000", "count": "1" }, { "item": "1948-03-13T00:00:00.000", "count": "1" }, { "item": "1948-03-14T00:00:00.000", "count": "1" }, { "item": "1948-03-15T00:00:00.000", "count": "1" }, { "item": "1948-03-16T00:00:00.000", "count": "1" }, { "item": "1948-03-17T00:00:00.000", "count": "1" }, { "item": "1948-03-18T00:00:00.000", "count": "1" }, { "item": "1948-03-19T00:00:00.000", "count": "1" } ], "null": "0", "count": "27223", "largest": "2022-09-09T00:00:00.000", "non_null": "27223", "smallest": "1948-02-28T00:00:00.000", "cardinality": "27223" }, "renderTypeName": "calendar_date" }, { "id": 43302993, "name": "PRCP", "format": {}, "position": 4, "fieldName": "prcp", "description": "", "dataTypeName": "number", "tableColumnId": 32230047, "cachedContents": { "top": [ { "item": "0.00", "count": "15608" }, { "item": "0.01", "count": "1003" }, { "item": "0.02", "count": "748" }, { "item": "0.03", "count": "532" }, { "item": "0.04", "count": "459" }, { "item": "0.05", "count": "451" }, { "item": "0.06", "count": "430" }, { "item": "0.08", "count": "354" }, { "item": "0.07", "count": "343" }, { "item": "0.09", "count": "286" }, { "item": "0.12", "count": "282" }, { "item": "0.10", "count": "278" }, { "item": "0.13", "count": "268" }, { "item": "0.11", "count": "264" }, { "item": "0.14", "count": "242" }, { "item": "0.16", "count": "232" }, { "item": "0.15", "count": "229" }, { "item": "0.17", "count": "199" }, { "item": "0.20", "count": "178" }, { "item": "0.18", "count": "175" } ], "null": "7", "count": "27223", "largest": "5.02", "non_null": "27216", "smallest": "0.00", "cardinality": "213" }, "renderTypeName": "number" }, { "id": 43302994, "name": "SNOW", "format": {}, "position": 5, "fieldName": "snow", "description": "", "dataTypeName": "number", "tableColumnId": 32230048, "cachedContents": { "top": [ { "item": "0.0", "count": "22362" }, { "item": "0.2", "count": "41" }, { "item": "0.1", "count": "34" }, { "item": "0.4", "count": "30" }, { "item": "0.3", "count": "25" }, { "item": "0.5", "count": "22" }, { "item": "1.0", "count": "20" }, { "item": "0.7", "count": "19" }, { "item": "2.0", "count": "14" }, { "item": "0.8", "count": "14" }, { "item": "1.7", "count": "13" }, { "item": "0.6", "count": "12" }, { "item": "1.2", "count": "12" }, { "item": "1.4", "count": "11" }, { "item": "1.5", "count": "11" }, { "item": "1.1", "count": "10" }, { "item": "3.0", "count": "10" }, { "item": "2.2", "count": "8" }, { "item": "1.6", "count": "8" }, { "item": "2.6", "count": "7" } ], "null": "4445", "count": "27223", "largest": "20.0", "non_null": "22778", "smallest": "0.0", "cardinality": "65" }, "renderTypeName": "number" }, { "id": 43302995, "name": "SNWD", "format": {}, "position": 6, "fieldName": "snwd", "description": "", "dataTypeName": "number", "tableColumnId": 32230049, "cachedContents": { "top": [ { "item": "0.0", "count": "22446" }, { "item": "1.0", "count": "106" }, { "item": "2.0", "count": "78" }, { "item": "3.0", "count": "58" }, { "item": "4.0", "count": "36" }, { "item": "5.0", "count": "19" }, { "item": "7.0", "count": "13" }, { "item": "6.0", "count": "10" }, { "item": "8.0", "count": "8" }, { "item": "1.2", "count": "6" }, { "item": "3.1", "count": "6" }, { "item": "10.0", "count": "4" }, { "item": "3.9", "count": "3" }, { "item": "5.9", "count": "3" }, { "item": "7.1", "count": "3" }, { "item": "9.0", "count": "3" }, { "item": "5.1", "count": "2" }, { "item": "11.0", "count": "2" }, { "item": "16.0", "count": "2" }, { "item": "19.0", "count": "2" } ], "null": "4411", "count": "27223", "largest": "21.0", "non_null": "22812", "smallest": "0.0", "cardinality": "22" }, "renderTypeName": "number" }, { "id": 43302996, "name": "TAVG", "format": {}, "position": 7, "fieldName": "tavg", "description": "", "dataTypeName": "text", "tableColumnId": 32230050, "cachedContents": { "top": [ { "item": "44", "count": "234" }, { "item": "47", "count": "229" }, { "item": "46", "count": "224" }, { "item": "49", "count": "219" }, { "item": "45", "count": "212" }, { "item": "50", "count": "208" }, { "item": "48", "count": "204" }, { "item": "51", "count": "201" }, { "item": "58", "count": "197" }, { "item": "43", "count": "194" }, { "item": "60", "count": "188" }, { "item": "63", "count": "186" }, { "item": "53", "count": "184" }, { "item": "65", "count": "184" }, { "item": "42", "count": "183" }, { "item": "62", "count": "180" }, { "item": "57", "count": "170" }, { "item": "41", "count": "169" }, { "item": "61", "count": "169" }, { "item": "55", "count": "167" } ], "null": "21101", "count": "27223", "largest": "91", "non_null": "6122", "smallest": "0", "cardinality": "66" }, "renderTypeName": "text" }, { "id": 43302997, "name": "TMAX", "format": {}, "position": 8, "fieldName": "tmax", "description": "", "dataTypeName": "number", "tableColumnId": 32230051, "cachedContents": { "top": [ { "item": "50", "count": "951" }, { "item": "53", "count": "905" }, { "item": "51", "count": "869" }, { "item": "52", "count": "869" }, { "item": "54", "count": "827" }, { "item": "55", "count": "810" }, { "item": "49", "count": "792" }, { "item": "48", "count": "759" }, { "item": "47", "count": "757" }, { "item": "56", "count": "712" }, { "item": "58", "count": "710" }, { "item": "57", "count": "705" }, { "item": "46", "count": "678" }, { "item": "60", "count": "671" }, { "item": "59", "count": "662" }, { "item": "62", "count": "662" }, { "item": "67", "count": "642" }, { "item": "65", "count": "642" }, { "item": "64", "count": "636" }, { "item": "66", "count": "632" } ], "null": "2", "count": "27223", "largest": "108", "non_null": "27221", "smallest": "4", "cardinality": "90" }, "renderTypeName": "number" }, { "id": 43302998, "name": "TMIN", "format": {}, "position": 9, "fieldName": "tmin", "description": "", "dataTypeName": "number", "tableColumnId": 32230052, "cachedContents": { "top": [ { "item": "42", "count": "1103" }, { "item": "53", "count": "1089" }, { "item": "50", "count": "1081" }, { "item": "40", "count": "1072" }, { "item": "41", "count": "1059" }, { "item": "54", "count": "1054" }, { "item": "44", "count": "1042" }, { "item": "43", "count": "1041" }, { "item": "45", "count": "1027" }, { "item": "52", "count": "1015" }, { "item": "55", "count": "981" }, { "item": "51", "count": "975" }, { "item": "39", "count": "959" }, { "item": "46", "count": "941" }, { "item": "38", "count": "940" }, { "item": "47", "count": "938" }, { "item": "37", "count": "918" }, { "item": "49", "count": "904" }, { "item": "48", "count": "879" }, { "item": "56", "count": "842" } ], "null": "2", "count": "27223", "largest": "73", "non_null": "27221", "smallest": "0", "cardinality": "69" }, "renderTypeName": "number" } ], "columnName": null, "aggregationFunction": null }, "datasetUid": "niqh-ewd6", "hierarchies": [], "parameterOverrides": {} } } ], "createdAt": null, "description": "", "configuration": { "axisLabels": { "top": false, "left": false, "right": false, "bottom": false }, "localization": {}, "agGridColumnState": [ { "flex": null, "hide": true, "sort": null, "colId": "station", "pivot": false, "width": 128, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null }, { "flex": null, "hide": true, "sort": null, "colId": "name", "pivot": false, "width": 128, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null }, { "flex": null, "hide": true, "sort": null, "colId": "date", "pivot": false, "width": 128, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null }, { "flex": null, "hide": false, "sort": null, "colId": "prcp", "pivot": false, "width": 128, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null }, { "flex": null, "hide": false, "sort": null, "colId": "snow", "pivot": false, "width": 128, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null }, { "flex": null, "hide": false, "sort": null, "colId": "snwd", "pivot": false, "width": 128, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null }, { "flex": null, "hide": false, "sort": null, "colId": "tavg", "pivot": false, "width": 128, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null }, { "flex": null, "hide": false, "sort": null, "colId": "tmax", "pivot": false, "width": 128, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null }, { "flex": null, "hide": false, "sort": null, "colId": "tmin", "pivot": false, "width": 123.58999999999992, "pinned": null, "aggFunc": null, "rowGroup": false, "sortIndex": null, "pivotIndex": null, "rowGroupIndex": null } ], "viewSourceDataLink": true, "showDataTableControl": false } }, "dataset": { "datasetUid": "niqh-ewd6" }, "originalUid": "niqh-ewd6" }, "layout": { "h": 17, "i": "clientSideId_2-block-item-index-1", "w": 7, "x": 4, "y": 0, "minH": 9.9, "minW": 4, "moved": false, "static": false } }, { "type": "html", "value": "<h1><i>A Cool Story!!!</i><br></h1>", "layout": { "h": 6, "i": "clientSideId_2-block-item-index-2", "w": 4, "x": 0, "y": 15, "minW": 2, "moved": false, "static": false } } ], "presentable": true, "background_color": "#bed7e8" }, { "layout": "12", "components": [ { "type": "html", "value": "<div> asdf asdf asdf asdf sdf sadfasdf df df asdf asdf assdf asdfsdfsdfsddfdfd fasasdfasd fasdf asdf asdf asdf asd fasdf asd fasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asd fsss<br></div><div> asdfasdf asdf asdf asdf asdsadfasdfasdfasdfasdfasdfasdfasdfsadfsadfasdfasdf asdf asdf asdf asdfas dfas dfasd fasdf asdf asdf asdf f asdf asdfas dfasdf asdf asdf asdf asdf asdf <br></div><div>\\asdf asdf asdfas dfasdf aslkjlkj df sadf asdfas dfasdf sadf sadf asdf asdf asdf sadf asdf sadf sadf sadf sadf sadf asdf sadf asssdasdf asdf asdf asdf ddddasdf asdf asdf asdf asdf asdf sasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdfasd fasdf asdf asdf asdf asdfas dfasd<br></div><div>kf THe quick brown fox jumped over the lazy asddog. Packdfadfasdf my box with fjljliasdf asffdfgdfdfgdfgdsfg sdfgsdfgdfgddfgsdfg dsdfg dfg asdfsdf asdf asdf asdf sadf asdf asdf safd dasdfasdfasdfsdfasdfsdsadf sadf asdf asdf asdf saf sadf sadf sadf sadf sadf sadf sdf asdf sadf sdf sdf sdf sd fasdf asd fdf asdf asdf sadf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf sadf asdfasdf asdf asdf asdf asdf asdf asdf asdf sadf asdf as<br></div>", "layout": { "h": 25, "i": "clientSideId_5-block-item-index-0", "w": 6, "x": 0, "y": 0, "minW": 2, "moved": false, "static": false } }, { "type": "html", "value": "<div> asdf asdf asdf asdf sdf sadfasdf df df asdf asdf assdf asdfsdfsdfsddfdfd fasasdfasd fasdf asdf asdf asdf asd fasdf asd fasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asd fsss<br></div><div> asdfasdf asdf asdf asdf asdsadfasdfasdfasdfasdfasdfasdfasdfsadfsadfasdfasdf asdf asdf asdf asdfas dfas dfasd fasdf asdf asdf asdf f asdf asdfas dfasdf asdf asdf asdf asdf asdf <br></div><div>\\asdf asdf asdfas dfasdf aslkjlkj df sadf asdfas dfasdf sadf sadf asdf asdf asdf sadf asdf sadf sadf sadf sadf sadf asdf sadf asssdasdf asdf asdf asdf ddddasdf asdf asdf asdf asdf asdf sasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdfasd fasdf asdf asdf asdf asdfas dfasd<br></div><div>kf THe quick brown fox jumped over the lazy asddog. Packdfadfasdf my box with fjljliasdf asffdfgdfdfgdfgdsfg sdfgsdfgdfgddfgsdfg dsdfg dfg asdfsdf asdf asdf asdf sadf asdf asdf safd dasdfasdfasdfsdfasdfsdsadf sadf asdf asdf asdf saf sadf sadf sadf sadf sadf sadf sdf asdf sadf sdf sdf sdf sd fasdf asd fdf asdf asdf sadf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf sadf asdfasdf asdf asdf asdf asdf asdf asdf asdf sadf asdf as<br></div>", "layout": { "h": 25, "i": "clientSideId_5-block-item-index-1", "w": 6, "x": 0, "y": 25, "minW": 2, "moved": false, "static": false } }, { "type": "html", "value": "<div>update 1<br></div><div>udpate 2<br></div><div>asdf asdf aslldkf jas;lkdfj l;askdjf al;skdjf l;askdj fl;askdjf la;skdjf a;lskdjf a;lskdjfl;askdjf ;laskdjf ;laskdj fl;askdjf l;askdj flaskdj fl;askdj f;laskdj f;laskdj f;laskd jf;laskj df;l aksjdf ;laskdjf ;laskdj f;als kdjf ;laskdjf ;laskdj f ;laskdjf poawiejufpoa wieufpoawieur powqiuerpoqwieur poqw ieuropqwi europqwi eropqwieurpoqwieu rpoqwieurpoi;,xzmcv/.,zx mcv/.,zxmcv./, mzxcv.,zmxcv./,mzxcv./, mzxc.v/, mzxc./v,m zx/.c,vmzx/.c,v zx.c,vm xz.c/, vmzx./c, vmzx.c, vmzx.,cvm .xz,cvm lsakdf ;lzdsjf al;sdkfj a;lsdk fjas;ldfjsakdjfhaslkdfhlksajdlkasjdfjkhasdfjkhasgfkjhasdfjkhasdfkjashgfuwqyteruqyweruqwetriuweyriu wqeiru wqeiur ywqiuer yiwqe ropiwe uro[iweu j;lksajdfl;ksajdf l;<br></div><div><br></div><div>The quick brown fox jumped over the lazy dog. Pack my box with five dozen liquor jugs. Sphinx of black quartz, judge my vow.<br></div><div>asdfasdf asd fasdf asdf asdf asdfasdfasdfasdfasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asd fasdf asdf asdfasdfasdfas dfasdfpiasdjf ;laskdjf;laskjdf;lk ajsdf;lk asj df;l asjdf;l kasdf<br></div><div> asdfasd<br></div><div>f asdf asdf<br></div><div>f asdf asdfas dkjfa;sl djf;laksdjf;laskjdfl;aksjd;lf ajs ;dlf<br></div>", "layout": { "h": 32, "i": "clientSideId_5-block-item-index-2", "w": 5, "x": 6, "y": 0, "minW": 2, "moved": false, "static": false } } ], "presentable": false, "background_color": "#fdffac" }, { "layout": "12", "components": [ { "type": "socrata.visualization.pieChart", "value": { "vif": { "title": "", "format": { "type": "visualization_interchange_format", "version": 4 }, "series": [ { "type": "pieChart", "color": { "primary": "#3f51b5", "highlight": "#cccccc", "secondary": "#e55100" }, "label": null, "dataSource": { "type": "socrata.soql", "limit": 12, "filters": [], "measure": { "columnName": null, "aggregationFunction": "count" }, "orderBy": { "sort": "desc", "parameter": "measure" }, "dimension": { "columnName": "accountidentifier", "aggregationFunction": null }, "datasetUid": "ivcn-sia2" }, "showLegend": true } ], "description": "", "configuration": { "showValueLabels": true, "showOtherCategory": true, "viewSourceDataLink": true, "showValueLabelsAsPercent": false } }, "dataset": { "datasetUid": "ivcn-sia2" }, "originalUid": "ivcn-sia2" }, "layout": { "h": 15, "i": "clientSideId_3-block-item-index-0", "w": 5, "x": 7, "y": 0, "minH": 9.9, "minW": 4, "moved": false, "static": false } }, { "type": "html", "value": "<h1>A Headline!!!<br></h1>", "layout": { "h": 4, "i": "clientSideId_3-block-item-index-1", "w": 6, "x": 0, "y": 12, "minW": 2, "moved": false, "static": false } }, { "type": "html", "value": "<div>asdfasdfasdfasdfasdf asdf asdf asdf asdf asdf asdf asdfasdfasdf sadf sadf asdf asdf asdf asdfas dfasdf asdf asdf asdfa sSdasdfaWEWERWERWERWERWERWER<br></div><div><a href=\"https://github.com/socrata/platform-ui/pull/15056/files\">https://github.com/socrata/platform-ui/pull/15056/files</a><br></div><div>asdf asdf asdasd fasdf asdfasdfas dfasdfas dfasd fasdf asdf asdf asdf asdfa sdfasd fasdf asdf sadf asdf asdfsadf asdf asdfas dfsadf sadf asdf asdf asddddddddadsdfasdf asdfasdf ssfdf asdf sd<br></div>", "layout": { "h": 12, "i": "clientSideId_3-block-item-index-2", "w": 6, "x": 0, "y": 0, "minW": 2, "moved": false, "static": false } } ], "presentable": false, "background_color": "#f8b2b8" }, { "layout": "12", "components": [ { "type": "socrata.visualization.timelineChart", "value": { "vif": { "title": "", "format": { "type": "visualization_interchange_format", "version": 4 }, "series": [ { "type": "timelineChart", "color": { "primary": "#3f51b5", "highlight": "#cccccc" }, "label": null, "dataSource": { "type": "socrata.soql", "filters": [], "measure": { "columnName": "snow", "aggregationFunction": "sum" }, "orderBy": { "sort": "asc", "parameter": "dimension" }, "dimension": { "columnName": "date", "aggregationFunction": null }, "precision": "year", "datasetUid": "niqh-ewd6", "dateDisplayFormat": "YYYY" } } ], "description": "", "configuration": { "xAxisScalingMode": "fit", "viewSourceDataLink": true, "treatNullValuesAsZero": true } }, "dataset": { "datasetUid": "niqh-ewd6" }, "originalUid": "niqh-ewd6" }, "layout": { "h": 10, "i": "clientSideId_5-block-item-index-0", "w": 6, "x": 0, "y": 0, "minH": 9.9, "minW": 4, "moved": false, "static": false } }, { "type": "html", "value": "<h1>Another Heading!<br></h1>", "layout": { "h": 3, "i": "clientSideId_5-block-item-index-1", "w": 5, "x": 6, "y": 0, "minW": 2, "moved": false, "static": false } }, { "type": "html", "value": "<div><i>This is placeholder text. To get started, remove it and input your own information!</i> Or you could just leave this bit of text right here to experimednt witkh the design and layout of your story. Go ahead, add another! Using a variety of layouts and visual arrangefsdments will make your story stand out. Or that's what we like to think. This explains why we have all of these content blocks for you to fplay with. So get after it, author! Tell your story. It's going to be magnificent!dlllll<br></div>", "layout": { "h": 10, "i": "clientSideId_5-block-item-index-2", "w": 4, "x": 1, "y": 10, "minW": 2, "moved": false, "static": false } } ], "presentable": true, "background_color": "#f0f2ff" } ] } var myCopy = null; function recursiveDeepCopy(o) { var newO, i; if (typeof o !== 'object') { return o; } if (!o) { return o; } if ('[object Array]' === Object.prototype.toString.apply(o)) { newO = []; for (i = 0; i < o.length; i += 1) { newO[i] = recursiveDeepCopy(o[i]); } return newO; } newO = {}; for (i in o) { if (o.hasOwnProperty(i)) { newO[i] = recursiveDeepCopy(o[i]); } } return newO; }
Tests:
Lodash cloneDeep
myCopy = _.cloneDeep(MyLargerObject);
Native structuredClone
myCopy = structuredClone(MyLargerObject);
recursiveDeepCopy
myCopy = recursiveDeepCopy(MyLargerObject);
Json Clone
myCopy = JSON.parse(JSON.stringify(MyLargerObject));