binarysearch
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -22,2 +22,4 @@ | ||
module.exports.closest = function(arr,search,opts,comparitor) { | ||
if(arr.length === 1) return 0; | ||
if(typeof opts === 'function') { | ||
@@ -24,0 +26,0 @@ opts = {}; |
{ | ||
"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.1.1", | ||
"version": "0.1.2", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "url": "git://github.com/soldair/node-binarysearch.git" |
[![Build Status](https://secure.travis-ci.org/soldair/node-binarysearch.png)](http://travis-ci.org/soldair/node-binarysearch) | ||
node-binarysearch | ||
================= | ||
binarysearch | ||
============ | ||
@@ -7,0 +7,0 @@ 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. |
@@ -15,1 +15,7 @@ var test = require('tap').test; | ||
}); | ||
test("can get closest with one item",function(t){ | ||
var key = bs.closest([1],3,{end:true}); | ||
t.equals(key,0,key+' should have got 0 as key because there is only 1'); | ||
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
7693
174