# forgetful-circular-buffer

> A simple forgetful circular buffer

Latest version **1.0.0** (published 2022-02-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install forgetful-circular-buffer
pnpm add forgetful-circular-buffer
yarn add forgetful-circular-buffer
bun add forgetful-circular-buffer
```

## 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.0 |
| Published | 2022-02-22 |
| First published | 2022-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Mikhail Dezhurko |
| Maintainers | mdezh |
| Keywords | ts, typescript, typed, forgetful, circular, buffer, queue, data structures, lightweight |

## Links

- npm: https://www.npmjs.com/package/forgetful-circular-buffer
- Repository: https://github.com/mdezh/forgetful-circular-buffer
- npm.io page: https://npm.io/package/forgetful-circular-buffer

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-02-22
- 0.1.9 — 2022-02-16
- 0.1.8 — 2022-02-14
- 0.1.7 — 2022-02-13
- 0.1.6 — 2022-02-12
- 0.1.5 — 2022-02-10
- 0.1.4 — 2022-02-09
- 0.1.3 — 2022-02-08
- 0.1.2 — 2022-02-07
- 0.1.1 — 2022-02-07
- 0.1.0 — 2022-02-07

## README

# Forgetful circular buffer

A simple forgetful circular buffer (or circular queue) in TypeScript

- Tiny and lightweight
- Dependency-free (uses devDependencies only)
- 100% unit test coverage

# Usage

```TypeScript
import { CircularBuffer } from "forgetful-circular-buffer";

const buffer = new CircularBuffer<number>(5);

console.log(buffer.isEmpty());
// true

buffer.write(1);
buffer.write(2);
buffer.write(3);

console.log(buffer.getCurrentSize());
// 3

console.log(buffer.read());
// 1

// buffer.readAll() returns a Generator
for (const item of buffer.readAll()) {
  console.log(item);
}
// 2, 3
```

Also see [the example](https://github.com/mdezh/forgetful-circular-buffer/blob/master/examples/example.ts)

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