{"ScriptPreparationCode":null,"TestCases":[{"Name":"map","Code":"const cuteObject = {\r\n [1]: [ { name: \u0027luna\u0027, id: 135 } ],\r\n [3]: [ { name: \u0027fat\u0027, id: 136 } ]\r\n};\r\n\r\nconst newList = Object.keys(cuteObject).map(key =\u003E {\r\n const options = cuteObject[key].map(item =\u003E ({\r\n label: item.name,\r\n name: item.name,\r\n id: item.id,\r\n }));\r\n\r\n return {\r\n label: key,\r\n options: options,\r\n };\r\n });","IsDeferred":false},{"Name":"forEach","Code":"const cuteObject = {\r\n [1]: [ { name: \u0027luna\u0027, id: 135 } ],\r\n [3]: [ { name: \u0027fat\u0027, id: 136 } ]\r\n};\r\n\r\nconst newList = [];\r\nObject.keys(cuteObject).forEach(key =\u003E {\r\n const options = [];\r\n cuteObject[key].forEach(item =\u003E {\r\n options.push({\r\n label: item.name,\r\n name: item.name,\r\n id: item.id,\r\n });\r\n });\r\n\r\n newList.push({\r\n label: key,\r\n options: options,\r\n });\r\n});\r\n","IsDeferred":false},{"Name":"for loop","Code":"const cuteObject = {\r\n [1]: [ { name: \u0027luna\u0027, id: 135 } ],\r\n [3]: [ { name: \u0027fat\u0027, id: 136 } ]\r\n};\r\n\r\nconst newList = [];\r\nconst keys = Object.keys(cuteObject);\r\nconst keysLength = keys.length;\r\n\r\nfor (let i = 0; i \u003C keysLength; i\u002B\u002B) {\r\n const key = keys[i];\r\n const options = [];\r\n const items = cuteObject[key];\r\n const itemsLength = items.length;\r\n\r\n for (let j = 0; j \u003C itemsLength; j\u002B\u002B) {\r\n const item = items[j];\r\n options.push({\r\n label: item.name,\r\n name: item.name,\r\n id: item.id,\r\n });\r\n }\r\n\r\n newList.push({\r\n label: key,\r\n options: options,\r\n });\r\n}\r\n","IsDeferred":false}]}