{"_id":"binary-search","_rev":"3813534","name":"binary-search","description":"tiny binary search function with comparators","dist-tags":{"latest":"1.3.6"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"time":{"modified":"2025-06-05T11:19:19.000Z","created":"2013-05-21T14:35:56.693Z","1.3.6":"2019-08-06T13:16:22.191Z","1.3.5":"2019-02-08T12:40:20.857Z","1.3.4":"2018-06-25T12:51:54.930Z","1.3.3":"2018-01-29T20:34:01.938Z","1.3.2":"2016-08-04T15:44:06.059Z","1.3.1":"2016-08-03T16:51:55.262Z","1.3.0":"2016-04-26T23:35:42.019Z","1.2.0":"2014-04-14T13:41:15.935Z","1.1.2":"2014-04-09T19:35:59.504Z","1.1.1":"2013-10-16T14:30:06.335Z","1.1.0":"2013-10-10T16:27:12.333Z","1.0.2":"2013-08-29T12:15:45.608Z","1.0.1":"2013-05-21T14:37:30.617Z","1.0.0":"2013-05-21T14:35:56.693Z"},"users":{},"author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"versions":{"1.3.6":{"name":"binary-search","version":"1.3.6","description":"tiny binary search function with comparators","license":"CC0-1.0","typings":"./binary-search.d.ts","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"contributors":[{"name":"Darcy Parker","url":"https://github.com/darcyparker"}],"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0"},"scripts":{"test":"mocha"},"gitHead":"1caaa1207a11702612afd00ef7972855ea1e12a1","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"homepage":"https://github.com/darkskyapp/binary-search#readme","_id":"binary-search@1.3.6","_nodeVersion":"10.15.1","_npmVersion":"6.9.0","dist":{"shasum":"e32426016a0c5092f0f3598836a1c7da3560565c","size":2613,"noattachment":false,"key":"/binary-search/-/binary-search-1.3.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.3.6.tgz"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"_npmUser":{"name":"ironwallaby","email":"jay@darksky.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/binary-search_1.3.6_1565097382054_0.40071218180026724"},"_hasShrinkwrap":false,"publish_time":1565097382191,"_cnpm_publish_time":1565097382191,"_cnpmcore_publish_time":"2021-12-16T21:09:09.681Z"},"1.3.5":{"name":"binary-search","version":"1.3.5","description":"tiny binary search function with comparators","license":"CC0-1.0","typings":"./binary-search.d.ts","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"contributors":[{"name":"Darcy Parker","url":"https://github.com/darcyparker"}],"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0"},"scripts":{"test":"mocha"},"gitHead":"5cafcf8a414d96f67d88f4b8b54311cfb17b663d","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"homepage":"https://github.com/darkskyapp/binary-search#readme","_id":"binary-search@1.3.5","_nodeVersion":"10.15.0","_npmVersion":"6.7.0","dist":{"shasum":"479ad009589e0273cf54e5d74ab1546c489078ce","size":2571,"noattachment":false,"key":"/binary-search/-/binary-search-1.3.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.3.5.tgz"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"_npmUser":{"name":"ironwallaby","email":"jay@darksky.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/binary-search_1.3.5_1549629620683_0.6044900726009508"},"_hasShrinkwrap":false,"publish_time":1549629620857,"_cnpm_publish_time":1549629620857,"_cnpmcore_publish_time":"2021-12-16T21:09:09.954Z"},"1.3.4":{"name":"binary-search","version":"1.3.4","description":"tiny binary search function with comparators","license":"CC0-1.0","typings":"./binary-search.d.ts","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"contributors":[{"name":"Darcy Parker","url":"https://github.com/darcyparker"}],"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5"},"scripts":{"test":"mocha"},"gitHead":"fe9b771d6a5a000e4ad1b1bfb8913f5726285be6","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"homepage":"https://github.com/darkskyapp/binary-search#readme","_id":"binary-search@1.3.4","_npmVersion":"6.1.0","_nodeVersion":"8.11.3","_npmUser":{"name":"ironwallaby","email":"jay@darksky.net"},"dist":{"shasum":"d15f44ff9226ef309d85247fa0dbfbf659955f56","size":2573,"noattachment":false,"key":"/binary-search/-/binary-search-1.3.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.3.4.tgz"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/binary-search_1.3.4_1529931114847_0.811676440342141"},"_hasShrinkwrap":false,"publish_time":1529931114930,"_cnpm_publish_time":1529931114930,"_cnpmcore_publish_time":"2021-12-16T21:09:10.149Z"},"1.3.3":{"name":"binary-search","version":"1.3.3","description":"tiny binary search function with comparators","license":"CC0-1.0","typings":"./binary-search.d.ts","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"contributors":[{"name":"Darcy Parker","url":"https://github.com/darcyparker"}],"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5"},"scripts":{"test":"mocha"},"gitHead":"b930e2589da1c35d85a30f50efe2183fc5c5c92d","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"homepage":"https://github.com/darkskyapp/binary-search#readme","_id":"binary-search@1.3.3","_npmVersion":"5.6.0","_nodeVersion":"8.9.0","_npmUser":{"name":"ironwallaby","email":"jay@darksky.net"},"dist":{"shasum":"b5adb6fb279a197be51b1ee8b0fb76fcdc61b429","size":2545,"noattachment":false,"key":"/binary-search/-/binary-search-1.3.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.3.3.tgz"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/binary-search-1.3.3.tgz_1517258040995_0.07124281325377524"},"directories":{},"publish_time":1517258041938,"_hasShrinkwrap":false,"_cnpm_publish_time":1517258041938,"_cnpmcore_publish_time":"2021-12-16T21:09:10.353Z"},"1.3.2":{"name":"binary-search","version":"1.3.2","description":"tiny binary search function with comparators","license":"CC0-1.0","typings":"./binary-search.d.ts","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"contributors":[{"name":"Darcy Parker","url":"https://github.com/darcyparker"}],"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5"},"scripts":{"test":"mocha"},"gitHead":"887e9e031c1d3fe40f3f21cda2fee0cd800d5f81","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"homepage":"https://github.com/darkskyapp/binary-search#readme","_id":"binary-search@1.3.2","_shasum":"88c9b7bd2b7221d352da78ec887f5af2549e4de2","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"darkskyapp","email":"developer@forecast.io"},"dist":{"shasum":"88c9b7bd2b7221d352da78ec887f5af2549e4de2","size":2498,"noattachment":false,"key":"/binary-search/-/binary-search-1.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.3.2.tgz"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/binary-search-1.3.2.tgz_1470325444567_0.6622511600144207"},"directories":{},"publish_time":1470325446059,"_hasShrinkwrap":false,"_cnpm_publish_time":1470325446059,"_cnpmcore_publish_time":"2021-12-16T21:09:10.545Z"},"1.3.1":{"name":"binary-search","version":"1.3.1","description":"tiny binary search function with comparators","license":"CC0-1.0","typings":"./binary-search.d.ts","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"contributors":[{"name":"Darcy Parker","url":"https://github.com/darcyparker"}],"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5"},"scripts":{"test":"mocha"},"gitHead":"2d3a728a067411e08bff42e6f43055f664058d7c","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"homepage":"https://github.com/darkskyapp/binary-search#readme","_id":"binary-search@1.3.1","_shasum":"d531b68feef67b0cfee41ef0dc842d8b8465aaed","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"darkskyapp","email":"developer@forecast.io"},"dist":{"shasum":"d531b68feef67b0cfee41ef0dc842d8b8465aaed","size":2363,"noattachment":false,"key":"/binary-search/-/binary-search-1.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.3.1.tgz"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/binary-search-1.3.1.tgz_1470243113347_0.765671136090532"},"directories":{},"publish_time":1470243115262,"_hasShrinkwrap":false,"_cnpm_publish_time":1470243115262,"_cnpmcore_publish_time":"2021-12-16T21:09:10.772Z"},"1.3.0":{"name":"binary-search","version":"1.3.0","description":"tiny binary search function with comparators","license":"CC0-1.0","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5"},"scripts":{"test":"mocha"},"gitHead":"ad653616172d84581e77c8b2b5d10fa5ad9b776c","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"homepage":"https://github.com/darkskyapp/binary-search#readme","_id":"binary-search@1.3.0","_shasum":"37ce101b63a99f24f99bd0e9b191e65231ce7f53","_from":".","_npmVersion":"3.8.3","_nodeVersion":"5.10.1","_npmUser":{"name":"darkskyapp","email":"developer@forecast.io"},"dist":{"shasum":"37ce101b63a99f24f99bd0e9b191e65231ce7f53","size":2080,"noattachment":false,"key":"/binary-search/-/binary-search-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.3.0.tgz"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/binary-search-1.3.0.tgz_1461713739805_0.2880975103471428"},"directories":{},"publish_time":1461713742019,"_hasShrinkwrap":false,"_cnpm_publish_time":1461713742019,"_cnpmcore_publish_time":"2021-12-16T21:09:10.973Z"},"1.2.0":{"name":"binary-search","version":"1.2.0","description":"tiny binary search function with comparators","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"mocha":"1.9.x","chai":"1.6.x"},"bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"_id":"binary-search@1.2.0","dist":{"shasum":"895336bfa117666746095e7c1285317dc5467a32","size":1695,"noattachment":false,"key":"/binary-search/-/binary-search-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.2.0.tgz"},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"darkskyapp","email":"devsupport@darkskyapp.com"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"directories":{},"publish_time":1397482875935,"_hasShrinkwrap":false,"_cnpm_publish_time":1397482875935,"_cnpmcore_publish_time":"2021-12-16T21:09:11.188Z"},"1.1.2":{"name":"binary-search","version":"1.1.2","description":"tiny binary search function with comparators","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"mocha":"1.9.x","chai":"1.6.x"},"bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"_id":"binary-search@1.1.2","dist":{"shasum":"82add24bb7423ed20abc313c22a70f163f9575b5","size":1682,"noattachment":false,"key":"/binary-search/-/binary-search-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.1.2.tgz"},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"darkskyapp","email":"devsupport@darkskyapp.com"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"directories":{},"publish_time":1397072159504,"_hasShrinkwrap":false,"_cnpm_publish_time":1397072159504,"_cnpmcore_publish_time":"2021-12-16T21:09:11.490Z"},"1.1.1":{"name":"binary-search","version":"1.1.1","description":"tiny binary search function with comparators","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"mocha":"1.9.x","chai":"1.6.x"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"_id":"binary-search@1.1.1","dist":{"shasum":"2d6c7670efdfaa1e5457fc2c6ebc9e76d6208b47","size":1586,"noattachment":false,"key":"/binary-search/-/binary-search-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.1.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"darkskyapp","email":"developer@forecast.io"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"directories":{},"publish_time":1381933806335,"_hasShrinkwrap":false,"_cnpm_publish_time":1381933806335,"_cnpmcore_publish_time":"2021-12-16T21:09:11.705Z"},"1.1.0":{"name":"binary-search","version":"1.1.0","description":"tiny binary search function with comparators","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"mocha":"1.9.x","chai":"1.6.x"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"_id":"binary-search@1.1.0","dist":{"shasum":"64beafbc5396e1dfe1f3c45b8ab4a520d9e875ba","size":1598,"noattachment":false,"key":"/binary-search/-/binary-search-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.1.0.tgz"},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"darkskyapp","email":"devsupport@darkskyapp.com"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"directories":{},"publish_time":1381422432333,"_hasShrinkwrap":false,"_cnpm_publish_time":1381422432333,"_cnpmcore_publish_time":"2021-12-16T21:09:11.918Z"},"1.0.2":{"name":"binary-search","version":"1.0.2","description":"tiny binary search function with comparators","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"mocha":"1.9.x","chai":"1.6.x"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"_id":"binary-search@1.0.2","dist":{"shasum":"2e6bec7ad822a98f1e87459c3d459553d35d42a1","size":1443,"noattachment":false,"key":"/binary-search/-/binary-search-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.0.2.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"darkskyapp","email":"developer@forecast.io"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"directories":{},"publish_time":1377778545608,"_hasShrinkwrap":false,"_cnpm_publish_time":1377778545608,"_cnpmcore_publish_time":"2021-12-16T21:09:12.109Z"},"1.0.1":{"name":"binary-search","version":"1.0.1","description":"tiny binary search function with comparators","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/binary-search.git"},"devDependencies":{"mocha":"1.9.x","chai":"1.6.x"},"readmeFilename":"README.md","_id":"binary-search@1.0.1","dist":{"shasum":"1fa824aa2aebdea65abcde0c218b75c80443dd42","size":1324,"noattachment":false,"key":"/binary-search/-/binary-search-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.0.1.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"darkskyapp","email":"devsupport@darkskyapp.com"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"directories":{},"publish_time":1369147050617,"_hasShrinkwrap":false,"_cnpm_publish_time":1369147050617,"_cnpmcore_publish_time":"2021-12-16T21:09:12.300Z"},"1.0.0":{"name":"binary-search","version":"1.0.0","description":"tiny binary search function with comparators","author":{"name":"The Dark Sky Company, LLC","email":"support@darkskyapp.com"},"repository":{"type":"git","url":"git://github.com/darkskyapp/pbj.git"},"devDependencies":{"mocha":"1.9.x","chai":"1.6.x"},"readmeFilename":"README.md","_id":"binary-search@1.0.0","dist":{"shasum":"bab97a5e9209fa357b54d1c733850250cc1f7090","size":1325,"noattachment":false,"key":"/binary-search/-/binary-search-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search/download/binary-search-1.0.0.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"darkskyapp","email":"devsupport@darkskyapp.com"},"maintainers":[{"name":"darkskybot","email":"developer@darksky.net"},{"name":"ironwallaby","email":"jay@darksky.net"}],"directories":{},"publish_time":1369146956693,"_hasShrinkwrap":false,"_cnpm_publish_time":1369146956693,"_cnpmcore_publish_time":"2021-12-16T21:09:12.560Z"}},"readme":"binary-search\n=============\n\nThis is a really tiny, stupid, simple binary search library for Node.JS. We\nwrote it because existing solutions were bloated and incorrect.\n\nThis version is a straight port of the Java version mentioned by Joshua Bloch\nin his article, [Nearly All Binary Searches and Merge Sorts are Broken](http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html).\n\nThanks to [Conrad Irwin](https://github.com/ConradIrwin) and [Michael\nMarino](https://github.com/mgmarino) for, ironically, pointing out bugs.\n\nExample\n-------\n\n```js\nvar bs = require(\"binary-search\");\n\nbs([1, 2, 3, 4], 3, function(element, needle) { return element - needle; });\n// => 2\n\nbs([1, 2, 4, 5], 3, function(element, needle) { return element - needle; });\n// => -3\n```\n\nBe advised that passing in a comparator function is *required*. Since you're\nprobably using one for your sort function anyway, this isn't a big deal.\n\nThe comparator takes a 1st and 2nd argument of element and needle, respectively.\n\nThe comparator also takes a 3rd and 4th argument, the current index and array,\nrespectively. You shouldn't normally need the index or array to compare values,\nbut it's there if you do.\n\nYou may also, optionally, specify an input range as the final two parameters,\nin case you want to limit the search to a particular range of inputs. However,\nbe advised that this is generally a bad idea (but sometimes bad ideas are\nnecessary).\n\nLicense\n-------\n\nTo the extent possible by law, The Dark Sky Company, LLC has [waived all\ncopyright and related or neighboring rights][cc0] to this library.\n\n[cc0]: http://creativecommons.org/publicdomain/zero/1.0/\n","_attachments":{},"homepage":"https://github.com/darkskyapp/binary-search#readme","bugs":{"url":"https://github.com/darkskyapp/binary-search/issues"},"license":"CC0-1.0"}