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

upper-bound

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

upper-bound

Find the index of the first element greater than x in a sorted array

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

upper-bound

Finds the first item in a sorted array greater than a given value.

DEPRECATED

Use binary-search-bounds instead

Use

First install using npm:

npm install upper-bound

Then use as follows:

var ub = require("upper-bound")

console.log(ub([0, 1, 1, 1, 2], 0))    // Prints 1
console.log(ub([0, 1, 1, 1, 2], 1))    // Prints 4

require("upper-bound")(array, value[, compare, lo, hi])

Uses a binary search to find the first item which is greater than value in array.

  • array a sorted list of items
  • value the item to find
  • compare a comparison function (optional)
  • lo a lower bound to search on (optional)
  • hi an upper bound on the range to search on (optional)

Credits

(c) 2013 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 15 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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