Embed URL


SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

An implementation of reduce modeled after the underscore.js api that does not default to Array.prototype.reduce.

View reduce.js
1 2 3 4 5 6 7 8
function reduce(obj, iterator, memo, ctx) {
var keys = Object.keys(obj),
memo = memo || obj[keys[0]];
ctx = ctx || null;
for (var i = arguments[2] ? 0 : 1; i < keys.length; i++)
memo =, memo, obj[keys[i]], keys[i], obj);
return memo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.