binzerch
v1.0.1
Published
Simple binary search.
Readme
binzerch
Simple binary search.
Install
$ npm install --save binzerchUsage
const binzerch = require('binzerch');
binzerch('foo', ['bar', 'baz', 'foo']);
//=> 2
binzerch('qux', ['bar', 'baz', 'foo']);
//=> -1API
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
