# tiny-queue

> Simple FIFO queue implementation to avoid having to do shift() on an array, which is slow.

Latest version **0.2.1** (published 2014-08-11) · Apache 2 license · 0 weekly downloads

## Install

```sh
npm install tiny-queue
pnpm add tiny-queue
yarn add tiny-queue
bun add tiny-queue
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2014-08-11 |
| First published | 2014-05-23 |
| Weekly downloads | 0 |
| License | Apache 2 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Nolan Lawson |
| Maintainers | nolanlawson |
| Keywords | queue, fifo |

## Links

- npm: https://www.npmjs.com/package/tiny-queue
- Repository: https://github.com/nolanlawson/tiny-queue
- Issues: https://github.com/nolanlawson/tiny-queue/issues
- npm.io page: https://npm.io/package/tiny-queue

## 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

- 0.2.1 (latest) — 2014-08-11
- 0.2.0 — 2014-05-23
- 0.1.0 — 2014-05-23

## README

tiny-queue
============

A simple FIFO queue implementation to avoid having to do `shift()`
on an array, which is slow. It's implemented in the straightforward `root -> node1 -> node2 -> etc.`
architecture that we all remember from CS 101.

This can typically be used as a drop-in replacement for an array, and it's only 38 lines of code.

### Status

[![browser support](https://ci.testling.com/nolanlawson/tiny-queue.png)](https://ci.testling.com/nolanlawson/tiny-queue)

### Usage

```
npm install tiny-queue
```

Then:

```js
var Queue = require('tiny-queue');
var queue = new Queue();

queue.push('foo');
queue.push('bar');
queue.shift(); // 'foo'
queue.shift(); //'bar'
queue.length; // 0
queue.shift(); // undefined
```

### API

The returned `Queue` object, once instantiated, only supports
four operations:

```js
queue.push()
queue.shift()
queue.slice() // returns a regular Array
queue.length
```

So it's basically a drop-in replacement for most na&iuml;ve usages
of an array as a queue.

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