DanC DanC - 9 months ago 57
jQuery Question

jQuery equivalent of underscore.js' groupBy

Is there a built in function in jQuery that does the equivalent of http://underscorejs.org/#groupBy ?

Any workarounds?


Answer Source

No. jQuery was not made for data handling, but for DOM, Ajax and Animations - those utility functions as each, map or grep which are needed internally suck.

Use Underscore, there is nothing wrong with it! If you don't want to load the whole script, you can easily copy the groupby function from the source to wherever you need it. Don't forget to add a comment on its origin.