1.0.1 • Published 7 years ago

binzerch v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

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

1.0.1

7 years ago

1.0.0

7 years ago