Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/invertase/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.
https://github.com/invertase/denque
Last synced: 10 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/invertase/denque
- Owner: invertase
- License: apache-2.0
- Created: 2016-07-02T00:11:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T08:16:33.000Z (over 1 year ago)
- Last Synced: 2024-10-29T13:10:41.095Z (10 days ago)
- Language: JavaScript
- Homepage: https://docs.page/invertase/denque
- Size: 156 KB
- Stars: 353
- Watchers: 14
- Forks: 33
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crafted-nodejs - denque - Double ended queue (Packages / Others)
- awesome-list - denque - ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. | invertase | 257 | (JavaScript)
- awesome-javascript - denque - ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. (Packages)
- awesome-javascript - denque - ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. (Packages)
README
Denque
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)
---
Built and maintained by Invertase.