Skip to content

Instantly share code, notes, and snippets.

@spolu
Created October 8, 2013 14:04
Show Gist options
  • Save spolu/6885200 to your computer and use it in GitHub Desktop.
Save spolu/6885200 to your computer and use it in GitHub Desktop.
(function($, cb_) {
var r = {
pay: 0,
insights: 0,
only_one: 0,
total: 0,
morethan5: 0,
betwen2and5: 0
}
$.forEach(function(u) {
if(u['Payer ID'].length > 0 && u['Payer ID'].toLowerCase() !== 'free') {
r.pay++;
if(u['Insights'].length > 0) {
r.insights++;
var i_count = u['Insights'].split('/').length;
if(i_count === 1)
r.only_one++;
if(i_count > 5)
r.morethan5++;
if(i_count > 1 && i_count < 6)
r.betwen2and5++;
}
}
r.total++;
});
return cb_(r);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment