{"ScriptPreparationCode":null,"TestCases":[{"Name":"Using the spread operator","Code":"const users = [{ id: 1, name: \u0027foo\u0027 }, { id: 2, name: \u0027bar\u0027 }]\r\nusers.reduce((x, user) =\u003E ({...x, [user.id]: user}), {});\r\n","IsDeferred":false},{"Name":"Using Object.assign","Code":"const users = [{ id: 1, name: \u0027foo\u0027 }, { id: 2, name: \u0027bar\u0027 }]\r\nusers.reduce((x, user) =\u003E Object.assign(x, { [user.id]: user }), {});","IsDeferred":false},{"Name":"Returning the reference","Code":"const users = [{ id: 1, name: \u0027foo\u0027 }, { id: 2, name: \u0027bar\u0027 }]\r\nusers.reduce((x, user) =\u003E { x[user.id] = user; return x; }, {});","IsDeferred":false}]}