binzerch
v1.0.1
Published
Simple binary search.
Downloads
6
Readme
binzerch
Simple binary search.
Install
$ npm install --save binzerch
Usage
const binzerch = require('binzerch');
binzerch('foo', ['bar', 'baz', 'foo']);
//=> 2
binzerch('qux', ['bar', 'baz', 'foo']);
//=> -1
API
binzerch(item, arr)
Returns the index of item
in arr
or -1
if item
is not found.
item
Type: Number
or String
The value to search for.
arr
Type: Array(Number)
or Array(String)
The sorted array to search in.
License
MIT © Max Hallinan