{"ScriptPreparationCode":"var data = Array.from({length: 1000}, (v, i) =\u003E ({ name: \u0060${i \u002B 1}\u0060, value: i \u002B 1}));\r\n\r\nvar keyBy = (array, fn) =\u003E {\r\n return array.reduce((acc, value) =\u003E {\r\n acc[fn(value)] = value;\r\n return acc;\r\n }, {});\r\n};\r\n\r\nvar keyByUsingSpread = (array, fn) =\u003E {\r\n return array.reduce((acc, value) =\u003E {\r\n return {\r\n ...acc,\r\n [fn(value)]: value\r\n };\r\n }, {});\r\n};\r\n\r\n","TestCases":[{"Name":"lodash/keyBy","Code":"_.keyBy(data, (v) =\u003E v.name);","IsDeferred":false},{"Name":"keyBy with native reduce ","Code":"keyBy(data, (v) =\u003E v.name);","IsDeferred":false},{"Name":"keyBy using native reduce and spread operator","Code":"keyByUsingSpread(data, (v) =\u003E v.name);","IsDeferred":false}]}