<commit_before>binary-search-insert
====================

Features
--------

Installing
----------

Usage
-----

Testing
-------

License
-------
[MIT](https://raw.githubusercontent.com/cflynn07/binary-search-insert/master/LICENSE)<commit_msg>Add badges and assorted details to README<commit_after>binary-search-insert
====================
[![Build Status](https://travis-ci.org/cflynn07/binary-search-insert.svg)](https://travis-ci.org/cflynn07/binary-search-insert)
[![Code Climate](https://codeclimate.com/github/cflynn07/binary-search-insert/badges/gpa.svg)](https://codeclimate.com/github/cflynn07/binary-search-insert)
[![Test Coverage](https://codeclimate.com/github/cflynn07/binary-search-insert/badges/coverage.svg)](https://codeclimate.com/github/cflynn07/binary-search-insert)
[![Dependency Status](https://david-dm.org/cflynn07/binary-search-insert.svg)](https://david-dm.org/cflynn07/binary-search-insert)
[![devDependency Status](https://david-dm.org/cflynn07/binary-search-insert/dev-status.svg)](https://david-dm.org/cflynn07/binary-search-insert#info=devDependencies)

[![NPM](https://nodei.co/npm/binary-search-insert.png?compact=true)](https://nodei.co/npm/binary-search-insert/)

A library for performing a binary search and insert into a sorted array.  
Binary search has a time complexity of O(log(n)) which is substantially faster than a linear search
with a time complexity of O(n).

Installing
----------
```
$ npm install binary-search-insert
```

Usage
-----
```
var binarySearchInsert = require('binary-search-insert');
var sortedArray = [1, 3, 5, 7, 9, 11];

// will mutate sortedArray and return index of inserted value
var indexInsertedAt = binarySearchInsert(sortedArray, 6);
// indexInsertedAt: 3
// sortedArray: [1, 3, 5, 6, 7, 9, 11]
```

Testing
-------
```
// Tests + coverage reports are run using Lab
$ npm test
// Test coverage reports
$ npm run test-cov # will auto-open Google Chrome with html coverage report
```

License
-------
[MIT](https://raw.githubusercontent.com/cflynn07/binary-search-insert/master/LICENSE)
{'fraction_non_alphanumeric': 0.19436345966958213, 'fraction_numerical': 0.019922254616132166, 'mean_word_length': 4.375979112271541, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, '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': '2575370', 'n_tokens_mistral': 703, 'n_tokens_neox': 653, 'n_words': 124}