Hacker News new | ask | show | jobs
by edgarvm 2570 days ago
You don't need a function, this is my little trick to convert an array to object

peopleObj = peopleArr.reduce( (a,x) => (a[x.username]=x, a), {} );