Comment Comment by edgarvm You don't need a function, this is my little trick to convert an array to objectpeopleObj = peopleArr.reduce( (a,x) => (a[x.username]=x, a), {} ); parent edgarvm 7 years ago
peopleObj = peopleArr.reduce( (a,x) => (a[x.username]=x, a), {} );