binarysearch
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -190,4 +190,4 @@ | ||
var match = comparitor(arr[min],search); | ||
if(min == arr.length-1 && match === -1) return min; | ||
if(min == 0 && match === 1) return 0; | ||
if(min == arr.length-1 && match < 0) return min; | ||
if(min == 0 && match > 0) return 0; | ||
@@ -194,0 +194,0 @@ return closest?(invert?min+1:min-1):-1; |
{ | ||
"name": "binarysearch", | ||
"description": "pure js binary search for sorted javascript arrays||array like objects. returns any || last || first || closest matched key for value, or slice between 2 values where values need not exist.", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"repository": { | ||
@@ -12,3 +12,6 @@ "url": "git://github.com/soldair/node-binarysearch.git" | ||
}, | ||
"author": "Ryan Day <soldair@gmail.com>", | ||
"contributors":[ | ||
"Ryan Day <soldair@gmail.com>", | ||
"Nicolas LaCasse <nicolas.lacasse@gmail.com> (https://github.com/nlacasse)" | ||
], | ||
"dependencies": {}, | ||
@@ -15,0 +18,0 @@ "devDependencies": { |
@@ -42,2 +42,11 @@ var test = require('tap').test; | ||
test("can handle numbers with big gaps",function(t){ | ||
var arr = [ 1384217040821830, 1384217040822643, 1384217040825255 ]; | ||
var obj = 1384217040826148; | ||
var key = bs.insert(arr,obj) | ||
t.equals(arr[3],obj,' should have correct object at offset'); | ||
t.end(); | ||
}) | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13972
315