{"ScriptPreparationCode":"const users = [{id: 1, name: \u0027cool\u0027}, {id:2, name: \u0027cool2\u0027}, {id:3, name: \u0027cool3\u0027}];\r\nconst usersWithPerms = [{id: 1, perm: \u0027yes\u0027}, {id:2, perm: \u0027no\u0027}, {id:3, perm: \u0027yes\u0027}];\r\n\r\nvar loopedFindBy = () =\u003E {\r\n const result = [];\r\n users.forEach((user) =\u003E {\r\n const rawEntry = usersWithPerms.find(\r\n (entry) =\u003E entry.id === user.id\r\n );\r\n result.push(rawEntry);\r\n });\r\n return result;\r\n}\r\n\r\nvar keyByTest = () =\u003E {\r\n const result = [];\r\n const userPermsById = _.keyBy(usersWithPerms, \u0027id\u0027);\r\n users.forEach((user) =\u003E {\r\n const rawEntry = userPermsById[user.id];\r\n result.push(rawEntry);\r\n })\r\n return result;\r\n}","TestCases":[{"Name":"looped findby","Code":"loopedFindBy();","IsDeferred":false},{"Name":"keyByTest","Code":"keyByTest();","IsDeferred":false}]}