<commit_before># binary-search-party

Asynchronous or Synchronous binary search.  This can be useful for seraching through really useless databases like a pipermail archive.  If you essentially just have a key value store and a list of keys that are known to be in order, you can efficiently search for a specific value using this module.

[![Build Status](https://img.shields.io/travis/ForbesLindesay/binary-search-party/master.svg)](https://travis-ci.org/ForbesLindesay/binary-search-party)
[![Dependency Status](https://img.shields.io/gemnasium/ForbesLindesay/binary-search-party.svg)](https://gemnasium.com/ForbesLindesay/binary-search-party)
[![NPM version](https://img.shields.io/npm/v/binary-search-party.svg)](https://www.npmjs.org/package/binary-search-party)

## Installation

    npm install binary-search-party

## API

### Synchronous

```js
var search = require('binary-search-party')

var haystack = [1, 2, 3, 4, 5]
var needle = 4

var index = search(haystack, function (val) {
  if (val === needle) return 0
  if (val < needle) return -1
  if (val > needle) return +1<commit_msg>Update badges<commit_after># binary-search-party

Asynchronous or Synchronous binary search.  This can be useful for seraching through really useless databases like a pipermail archive.  If you essentially just have a key value store and a list of keys that are known to be in order, you can efficiently search for a specific value using this module.

[![Build Status](https://img.shields.io/travis/ForbesLindesay/binary-search-party/master.svg)](https://travis-ci.org/ForbesLindesay/binary-search-party)
[![Dependency Status](https://img.shields.io/david/ForbesLindesay/binary-search-party.svg)](https://david-dm.org/ForbesLindesay/binary-search-party)
[![NPM version](https://img.shields.io/npm/v/binary-search-party.svg)](https://www.npmjs.org/package/binary-search-party)

## Installation

    npm install binary-search-party

## API

### Synchronous

```js
var search = require('binary-search-party')

var haystack = [1, 2, 3, 4, 5]
var needle = 4

var index = search(haystack, function (val) {
  if (val === needle) return 0
  if (val < needle) return -1
  if (val > needle) return +1
{'fraction_non_alphanumeric': 0.13135011441647598, 'fraction_numerical': 0.008237986270022883, 'mean_word_length': 4.59079283887468, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6357906', 'n_tokens_mistral': 735, 'n_tokens_neox': 692, 'n_words': 198}