_.groupBy(list, [iterator]) #864

chbrown opened this Issue Nov 18, 2012 · 1 comment


None yet

2 participants


I think _.groupBy(list, iterator) should have an optional iterator, defaulting to _.identity, i.e.: _.groupBy(list, [iterator]) == _.groupBy(list, _.identity).

In other languages with a groupBy function (Python and Scala are the two I'm familiar with / have used their group-by implementation), the default is to use each item's value.

@jashkenas jashkenas closed this in 0a2adcb Nov 19, 2012

Good idea. I think that it's unfortunate that the "by" part of the function names will feel wrong ... but still worth having as a default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment