Rob's garden / notes / note

Note

#JavaScript shouldn't let you destructure like this 😬

It groups the array by the "username" key on each record then gets the result for the current member using a dynamic accessor and maps it to the name "memberRecords" then sets the rest of the keys to perMember.

A bit gross, will refactor out tomorrow

const { [member.username]: memberRecords, ...perMember } = groupBy(
  records,
  (r) => r.username,
)

Code screenshot