binary-search
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -10,3 +10,3 @@ module.exports = function(haystack, needle, comparator) { | ||
mid = 0, | ||
high = (haystack.length - 1) >>> 0, | ||
high = haystack.length - 1, | ||
cmp = 0; | ||
@@ -17,3 +17,3 @@ | ||
* to double (which gives the wrong results). */ | ||
mid = (low + ((high - low) >> 1)) >>> 0; | ||
mid = low + (high - low >> 1); | ||
cmp = comparator(haystack[mid], needle)|0; | ||
@@ -23,7 +23,7 @@ | ||
if(cmp < 0) | ||
low = (mid + 1) >>> 0; | ||
low = mid + 1; | ||
/* Too high. */ | ||
else if(cmp > 0) | ||
high = (mid - 1) >>> 0; | ||
high = mid - 1; | ||
@@ -30,0 +30,0 @@ /* Key found. */ |
{ | ||
"name": "binary-search", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "tiny binary search function with comparators", | ||
@@ -5,0 +5,0 @@ "author": { |
3029