const groupBy = (arr, prop) => arr.reduce((acc, val) => { ;(acc[val[prop]] = acc[val[prop]] || []).push(val) return acc }, {})