DanC DanC - 1 year ago 182
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download