{"ScriptPreparationCode":"function shuffleArray(array) {\r\n for (let i = array.length - 1; i \u003E 0; i--) {\r\n const j = Math.floor(Math.random() * (i \u002B 1));\r\n [array[i], array[j]] = [array[j], array[i]];\r\n }\r\n}\r\n\r\nvar ids = [];\r\nvar uuids = [];\r\nvar entities = {};\r\nvar itemIdByUuid = {};\r\nfor(let i = 0; i \u003C 5000; i\u002B\u002B) {\r\n const obj = {\r\n id: \u0060id${i}\u0060,\r\n uuid: crypto.randomUUID(),\r\n foo: \u0022bar\u0022,\r\n bar: \u0022foo\u0022,\r\n };\r\n \r\n entities[obj.id] = obj;\r\n ids.push(obj.id);\r\n itemIdByUuid[obj.uuid] = obj.id;\r\n}","TestCases":[{"Name":"finding item using find with Object.values","Code":"const randomUUID = uuids[Math.floor(Math.random() * uuids.length)];\r\nconst itemMatchingSomeUUID = Object.values(entities).find((obj) =\u003E obj.uuid === randomUUID);","IsDeferred":false},{"Name":"finding item using find without Object.values (accessing entities using the ids array)","Code":"const randomUUID = uuids[Math.floor(Math.random() * uuids.length)];\r\nconst itemMatchingSomeUUID = ids.map((id) =\u003E entities[id]).find((obj) =\u003E obj.uuid === randomUUID);","IsDeferred":false},{"Name":"using the itemIdByUuid \u0022projection\u0022 we created","Code":"const randomUUID = uuids[Math.floor(Math.random() * uuids.length)];\r\nconst itemMatchingSomeUUID = entities[itemIdByUuid[randomUUID]];","IsDeferred":false}]}