# @namhong2001/binary-search

> very simple number based binary search

Latest version **1.0.1** (published 2022-12-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @namhong2001/binary-search
pnpm add @namhong2001/binary-search
yarn add @namhong2001/binary-search
bun add @namhong2001/binary-search
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-12-23 |
| First published | 2022-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | namhong2001 |
| Maintainers | namhong2001 |
| Keywords | binary-search, bsearch, binary, search |

## Links

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

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-12-23
- 1.0.0 — 2022-12-23

## README

# very simple binary search

## type definition

```typescript
/**
 * @param low inclusive, must be true on predicate function
 * @param high exclusive,
 * @param predicate predicate function
 */
declare const bsearch: (
  low: number,
  high: number,
  predicate: (mid: number) => boolean
) => number;
```

## Install

```shell
npm install @namhong2001/binary-search
```

## example

```typescript
bsearch(0, 10, (mid) => mid < 5); // 4
bsearch(0, 10, (mid) => mid < 50); // 9, because high(10) is exclusive
bsearch(0, 10, (mid) => mid < -50); // 0, return low(0) even if low is falsy on predicate
```

## LICENSE

MIT

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