Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/komayuki/js-binary-search
binary search
https://github.com/komayuki/js-binary-search
algorithm binary-search javascript nodejs
Last synced: about 1 month ago
JSON representation
binary search
- Host: GitHub
- URL: https://github.com/komayuki/js-binary-search
- Owner: komayuki
- Created: 2017-05-29T02:36:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-20T09:50:25.000Z (about 7 years ago)
- Last Synced: 2024-11-06T06:12:25.378Z (3 months ago)
- Topics: algorithm, binary-search, javascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# js-binary-search
## array
```
const bSearch = require('js-binary-search');
const array = [3, 5, 12, 56, 100];
bSeach.search(array, 12);
// return { index: 2, item: 12 }
```## associative_array
```
const bSearch = require('js-binary-search')
const array = [
{id: 2},
{id: 5},
{id: 13},
{id: 26}
]
bSeach.search_in_associative(array, 'id', 26)
// return {index: 3, item: {id: 26}}
```