Created
November 24, 2021 20:11
-
-
Save thomasnorris/43507acf6bdd0bb4300ff294bd44f3ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns grouping of arr by key | |
let groupBy = function(arr, key) { | |
return arr.reduce(function(rv, x) { | |
(rv[x[key]] = rv[x[key]] || []).push(x); | |
return rv; | |
}, {}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment