marcolanaro/JS-Fuzzy — pull request #3 by andrecaribe (2013-04-30 06:24:51+00:00)
Title: Bug fixed in function takeMaxOfArray

`takeMaxOfArray` now check all elements of array.

Old version:

takeMaxofArray: function(arr) {
if (arr.length === 1)
return arr[0];
else {
var max;
for (var j=arr.length-2;j>=0;j-=1)
max = Math.max(arr[j], arr[j+1]);
return max;
}
}

New version:

takeMaxOfArray: function(arr) {
var max = arr[0],
j;

for (j = 1; j < arr.length; j += 1) {
max = arr[j] > max ? arr[j] : max;
}

return max;
}