Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

binarysearch

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binarysearch - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

4

index.js

@@ -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();
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc