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

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -