Skip to content

Instantly share code, notes, and snippets.

@greatseth
Created November 29, 2012 20:28
Show Gist options
  • Save greatseth/4171693 to your computer and use it in GitHub Desktop.
Save greatseth/4171693 to your computer and use it in GitHub Desktop.
couchdb reduce function to find min value
function (key, values, rereduce) {
var min = Infinity
for (var i = 0; i < values.length; i++) {
if (typeof values[i] == 'number') {
max = Math.min(values[i], min)
}
}
return min
}
@pooyabrz
Copy link

you had to change "max" to "min"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment