-
-
Save rjcorwin/4171729 to your computer and use it in GitHub Desktop.
couchdb reduce function to find min value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (key, values, rereduce) { | |
var min = Infinity | |
for (var i = 0; i < values.length; i++) { | |
if (typeof values[i] == 'number') { | |
min = Math.min(values[i], min) | |
} | |
} | |
return min | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment