# big-sparse-array

> A sparse array optimised for low memory whilst still being fast

Latest version **1.0.3** (published 2022-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install big-sparse-array
pnpm add big-sparse-array
yarn add big-sparse-array
bun add big-sparse-array
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-11-22 |
| First published | 2020-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/big-sparse-array) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 33 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/big-sparse-array
- Repository: https://github.com/mafintosh/big-sparse-array
- Issues: https://github.com/mafintosh/big-sparse-array/issues
- npm.io page: https://npm.io/package/big-sparse-array

## Recent versions

- 1.0.3 (latest) — 2022-11-22
- 1.0.2 — 2020-11-26
- 1.0.1 — 2020-11-26
- 1.0.0 — 2020-11-26

## README

# big-sparse-array

A sparse array optimised for low memory whilst still being fast.

```
npm install big-sparse-array
```

Uses a shallow tree structure with a branching factor of 4096
to index a series of small arrays that try to compress as much as possible
to reduce the memory overhead needed.

Similar to a Map, except it is faster, but might use a bit more memory, ymmv.

## Usage

``` js
const BigSparseArray = require('big-sparse-array')

const b = new BigSparseArray()

b.set(42422242525, true)
b.get(42422242525) // returns true
b.get(111111111) // returns undefined
```

## API

#### `const b = new BigSparseArray()`

Make a new sparse array.

#### `b.set(index, value)`

Insert a new value at an index. `index` must be a integer.

#### `value = b.get(index)`

Get a value out. Returns `undefined` if the value could not be found.

## License

MIT

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