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

binary-search

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binary-search - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

18

binary-search.d.ts

@@ -5,12 +5,16 @@ //Typescript type definition for:

const enum compareResult {
lessThan = -1,
greaterThan = 1,
same = 0
}
function binarySearch<A>(
haystack: A[],
needle: A,
comparator: (a: A, b: A, index?: number, haystack?: A[]) => compareResult,
comparator: (a: A, b: A, index?: number, haystack?: A[]) => any,
// Notes about comparator return value:
// * when a<b the comparator's returned value should be:
// * negative number or a value such that `+value` is a negative number
// * examples: `-1` or the string `"-1"`
// * when a>b the comparator's returned value should be:
// * positive number or a value such that `+value` is a positive number
// * examples: `1` or the string `"1"`
// * when a===b
// * any value other than the return cases for a<b and a>b
// * examples: undefined, NaN, 'abc'
low?: number,

@@ -17,0 +21,0 @@ high?: number): number; //returns index of found result or number < 0 if not found

{
"name": "binary-search",
"version": "1.3.1",
"version": "1.3.2",
"description": "tiny binary search function with comparators",

@@ -5,0 +5,0 @@ "license": "CC0-1.0",

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