Skip to content

Instantly share code, notes, and snippets.

@mikeal
Created August 14, 2009 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeal/167554 to your computer and use it in GitHub Desktop.
Save mikeal/167554 to your computer and use it in GitHub Desktop.
function (keys, values, rereduce) {
retval = {pass:0, fail:0, todo:0}
var doTest = function (test) {
retval.pass = retval.pass + test.pass;
retval.fail = retval.fail + test.fail;
retval.todo = retval.todo + test.todo;
}
if (!rereduce) {
for (i in values) {
for (v in values[i]) {
doTest(values[i][v]);
}
}
} else {
for (i in values) {
doTest(values[i]);
}
}
return retval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment