Binarysjs
A simple npm library to make binary search with javascript
How to use
$ npm install binarysjs
# $ yarn add binarysjs
const { getIndex } = require('binarysjs');
const index = getIndex(target, array, startIndex?, endIndex?)
// target = The value you want to find
// array = The array you want to search in
// startIndex && endIndex = optional parameters you don't want to check the whole array
Return values
- Any number bigger than or equal to zero: Found value index
- -1: Value not found
Techs
- Node.js
- Typescript
- Jest
License
This project is under the MIT license. See the LICENSE for more information.
Made with by Giovani Farias Get in touch!