Denque is a high-performance double-ended queue (deque) implementation for JavaScript/Node.js, version 2.1.0. It provides O(1) operations for push, pop, shift, unshift, and random access via peekAt(index). Zero dependencies, ships TypeScript definitions. Maintained by Invertase, used by official Redis, MongoDB, MariaDB, MySQL and Redis clients. Outperforms other deque libraries like double-ended-queue in benchmarks.
npm install denqueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a Denque, push/unshift elements, shift/pop, and peek at index.
Use .toArray() or iterate with .get(i) instead of relying on internal array.
peekAt(-1) is safe, but be careful with negative out-of-bounds (returns undefined).
Convert to array via .toArray() and then use array methods.
Use .toArray() and re-create Denque for removal by index.
Use import Denque from 'denque' or const Denque = require('denque') as appropriate.const d = new Denque(); d.peekAt(0);
new Denque<number>([1,2,3]);
No dependency data recorded yet.