# denque

> The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. Maintains compatability with deque.

Latest version **2.1.0** (published 2022-07-18) · Apache-2.0 license · 0 weekly downloads

## Install

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

## 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 | 2.1.0 |
| Published | 2022-07-18 |
| First published | 2016-07-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 0 |
| Unpacked size | 29.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 373 |
| Author | Invertase |
| Maintainers | salakar |
| Keywords | data-structure, data-structures, queue, double, end, ended, deque, denque, double-ended-queue |

## Links

- npm: https://www.npmjs.com/package/denque
- Repository: https://github.com/invertase/denque
- Homepage: https://docs.page/invertase/denque
- Issues: https://github.com/invertase/denque/issues
- npm.io page: https://npm.io/package/denque

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

- 2.1.0 (latest) — 2022-07-18
- 2.0.1 — 2021-08-31
- 2.0.0 — 2021-08-18
- 1.5.1 — 2021-08-18
- 1.5.0 — 2021-01-04
- 1.4.1 — 2019-04-03
- 1.4.0 — 2018-11-10
- 1.3.0 — 2018-06-03
- 1.2.6 — 2018-05-24
- 1.2.5 — 2018-05-24
- 1.2.4 — 2018-05-24
- 1.2.3 — 2018-02-09
- 1.2.2 — 2017-08-15
- 1.2.1 — 2017-07-28
- 1.2.0 — 2017-07-28
- … 9 more at https://npm.io/package/denque/versions

## README

<p align="center">
  <h1 align="center">Denque</h1>
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/denque"><img src="https://img.shields.io/npm/dm/denque.svg?style=flat-square" alt="NPM downloads"></a>
  <a href="https://www.npmjs.com/package/denque"><img src="https://img.shields.io/npm/v/denque.svg?style=flat-square" alt="NPM version"></a>
  <a href="https://github.com/invertase/denque/actions/workflows/testing.yam"><img src="https://github.com/invertase/denque/actions/workflows/testing.yaml/badge.svg" alt="Tests status"></a>
  <a href="https://codecov.io/gh/invertase/denque"><img src="https://codecov.io/gh/invertase/denque/branch/master/graph/badge.svg?token=rn91iI4bSe" alt="Coverage"></a>
  <a href="/LICENSE"><img src="https://img.shields.io/npm/l/denque.svg?style=flat-square" alt="License"></a>
  <a href="https://twitter.com/invertaseio"><img src="https://img.shields.io/twitter/follow/invertaseio.svg?style=social&label=Follow" alt="Follow on Twitter"></a>
</p>

Denque is a well tested, extremely fast and lightweight [double-ended queue](http://en.wikipedia.org/wiki/Double-ended_queue)
implementation with zero dependencies and includes TypeScript types.

Double-ended queues can also be used as a:

- [Stack](http://en.wikipedia.org/wiki/Stack_\(abstract_data_type\))
- [Queue](http://en.wikipedia.org/wiki/Queue_\(data_structure\))

This implementation is currently the fastest available, even faster than `double-ended-queue`, see the [benchmarks](https://docs.page/invertase/denque/benchmarks).

Every queue operation is done at a constant `O(1)` - including random access from `.peekAt(index)`.

**Works on all node versions >= v0.10**

## Quick Start

Install the package:

```bash
npm install denque
```

Create and consume a queue:

```js
const Denque = require("denque");

const denque = new Denque([1,2,3,4]);
denque.shift(); // 1
denque.pop(); // 4
```


See the [API reference documentation](https://docs.page/invertase/denque/api) for more examples.

---

## Who's using it?

- [Kafka Node.js client](https://www.npmjs.com/package/kafka-node)
- [MariaDB Node.js client](https://www.npmjs.com/package/mariadb)
- [MongoDB Node.js client](https://www.npmjs.com/package/mongodb)
- [MySQL Node.js client](https://www.npmjs.com/package/mysql2)
- [Redis Node.js clients](https://www.npmjs.com/package/redis)

... and [many more](https://www.npmjs.com/browse/depended/denque).


---

## License

- See [LICENSE](/LICENSE)

---

<p align="center">
  <a href="https://invertase.io/?utm_source=readme&utm_medium=footer&utm_campaign=denque">
    <img width="75px" src="https://static.invertase.io/assets/invertase/invertase-rounded-avatar.png">
  </a>
  <p align="center">
    Built and maintained by <a href="https://invertase.io/?utm_source=readme&utm_medium=footer&utm_campaign=denque">Invertase</a>.
  </p>
</p>

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