# tiny-binary-search

> Very small binary search index implimentation.

Latest version **1.0.3** (published 2018-03-30) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install tiny-binary-search
pnpm add tiny-binary-search
yarn add tiny-binary-search
bun add tiny-binary-search
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-03-30 |
| First published | 2015-12-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Patrick Arlt |
| Maintainers | jgravois, patrickarlt |
| Keywords | arcgis, convert, geo, geojson, geometry |

## Links

- npm: https://www.npmjs.com/package/tiny-binary-search
- Repository: https://github.com/patrickarlt/tiny-binary-search
- Issues: https://github.com/patrickarlt/tiny-binary-search/issues
- npm.io page: https://npm.io/package/tiny-binary-search

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.3 (latest) — 2018-03-30
- 1.0.2 — 2015-12-30
- 1.0.1 — 2015-12-30
- 1.0.0 — 2015-12-30

## README

# tiny-binary-search

[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]

[npm-image]: https://img.shields.io/npm/v/tiny-binary-search.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/tiny-binary-search
[travis-image]: https://img.shields.io/travis/patrickarlt/tiny-binary-search.svg?style=flat-square
[travis-url]: https://travis-ci.org/patrickarlt/tiny-binary-search
[standard-image]: https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/semistandard

A very small binary search index.

## Install

```
npm install tiny-binary-search
```

## Usage

```js
var index = new BinarySearchIndex([
  { value: 0, id: "A" },
  { value: 1, id: "B" },
  { value: 2, id: "C" },
  { value: 3, id: "D" },
  { value: 4, id: "E" },
  { value: 5, id: "F" },
  { value: 6, id: "G" },
  { value: 7, id: "H" },
  { value: 8, id: "I" },
  { value: 9, id: "J" }
]);

index.query(5); // get the item with a value of 5

index.between(1, 3); // get all items with values between 1 and 3 (inclusive)

index.getIndex(0.5); // get the index of an item with a particular value in the array

index.insert({value: 0.5, id: "AA"}); // insert a single item into the index

index.bulkAdd([
  { value: 1.5, id: "BB" },
  { value: 2.5, id: "CC" },
]); // add an array of items to the index
```

This module is distributed as a [UMD]() module and can also be used in AMD based systems or as a global under the `BinarySearchIndex` namespace.

## Issues

Find a bug or want to request a new feature?  Please let us know by submitting an issue.

---
_Source: https://npm.io/package/tiny-binary-search · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
