Skip to content

Instantly share code, notes, and snippets.

View ozzyr's full-sized avatar
🎯
Focusing

Ozzyr ozzyr

🎯
Focusing
  • Itapecerica da serra
View GitHub Profile
@ozzyr
ozzyr / groupBy.js
Created June 29, 2020 15:25 — forked from suissa/groupBy.js
Group by bem facinho
const groupBy = (xs, key) => xs.reduce((rv, x) => ({
...rv, [x[key]]: [...(rv[x[key]] || []), x]
}), {});
@ozzyr
ozzyr / groupBy.js
Created June 29, 2020 15:25 — forked from suissa/groupBy.js
Group by bem facinho
const groupBy = (xs, key) => xs.reduce((rv, x) => ({
...rv, [x[key]]: [...(rv[x[key]] || []), x]
}), {});