Skip to content

Instantly share code, notes, and snippets.

@ncammarata
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save ncammarata/11019654 to your computer and use it in GitHub Desktop.

Select an option

Save ncammarata/11019654 to your computer and use it in GitHub Desktop.
$('.message').map(function() { return { author: $(this).find('.nickname').text(), likes: +$(this).find('.likes .count').text() } })
allGrouped = _.groupBy(all, function(val) { return val.author; })
fellas = _.map(allGrouped, function(val, key) {
likeTotal = val.map(function(val) { return val.likes; }).reduce(function(a, b) {return a + b;}, 0)
return {
who: key,
likeTotal: likeTotal,
likeAverage: likeTotal / val.length,
messageTotal: val.length
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment