# cyclist

> Cyclist is an efficient cyclic list implemention.

Latest version **1.0.2** (published 2023-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install cyclist
pnpm add cyclist
yarn add cyclist
bun add cyclist
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-05-28 |
| First published | 2013-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 39 |
| Author | Mathias Buus Madsen |
| Maintainers | mafintosh |
| Keywords | circular, buffer, ring, cyclic, data |

## Links

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

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-05-28
- 1.0.1 — 2015-05-13
- 1.0.0 — 2015-05-13
- 0.2.2 — 2013-07-30
- 0.2.1 — 2013-07-30
- 0.2.0 — 2013-06-19
- 0.1.1 — 2013-06-12
- 0.1.0 — 2013-06-12

## README

# Cyclist

Cyclist is an efficient [cyclic list](http://en.wikipedia.org/wiki/Circular_buffer) implemention for Javascript.
It is available through npm

```
npm install cyclist
```

[![build status](http://img.shields.io/travis/mafintosh/cyclist.svg?style=flat)](http://travis-ci.org/mafintosh/cyclist)

## What?

Cyclist allows you to create a list of fixed size that is cyclic.
In a cyclist list the element following the last one is the first one.
This property can be really useful when for example trying to order data
packets that can arrive out of order over a network stream.

## Usage

``` js
var cyclist = require('cyclist')
var list = cyclist(4)

list.put(42, 'hello 42') // store something and index 42
list.put(43, 'hello 43') // store something and index 43

console.log(list.get(42)) // prints hello 42
console.log(list.get(46)) // prints hello 42 again since 46 - 42 == list.size
```

## API

* `cyclist(size)` creates a new buffer
* `cyclist#get(index)` get an object stored in the buffer
* `cyclist#put(index,value)` insert an object into the buffer
* `cyclist#del(index)` delete an object from an index
* `cyclist#size` property containing current size of buffer

## License

MIT

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