underscore.js - Limit underscorejs group by length -


i have long list of articles grouped category, how can limit each category have 4 (or other number) items?

my input is: enter image description here

and want 4 articles on each section

map object values sliced versions of themselves:

_.mapobject(groupedarticles, function(group) { return group.slice(0, 4); }) 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -