Registry / testing / queuejs

queuejs

JSON →
library1.0.0jsnpmunverified

A minimalistic queue data structure for Node.js, version 1.0.0, released under MIT license. It provides basic FIFO operations (enqueue, dequeue, peek, size) with no dependencies. Last updated in 2018, it is stable but unmaintained, suitable for simple queue needs without advanced features like concurrency, iterators, or TypeScript support.

npm install queuejs
INSTALL
IMPORT
SIG · QUEUEJS
Q
queuejs
testingjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Queue
const Queue = require('queuejs')
import Queue from 'queuejs'
Package is CommonJS-only. ESM import (e.g., using import) will cause an error unless using a bundler that can handle CJS.
enq
queue.enq(element)
queue.enqueue(element)
The method is named enq, not enqueue. Common mistake to use the full word.
deq
queue.deq()
queue.dequeue()
The method is named deq, not dequeue. Throws Error when queue is empty.
peek
queue.peek()
queue.front() or queue.top()
Method is peek, not front/top. Throws Error if empty.

Creates a queue, enqueues two elements, demonstrates size, peek, and dequeue operations.

const Queue = require('queuejs'); const q = new Queue(); q.enq(10); q.enq(5); console.log(q.size()); // 2 console.log(q.peek()); // 10 console.log(q.deq()); // 10 console.log(q.size()); // 1
Debug
Known issues
gotchaMethod names are enq and deq, not enqueue/dequeue. Using wrong names will result in TypeError: queue.enqueue is not a function.
fix
Use enq() for enqueue and deq() for dequeue.
affects: >=1.0.0
gotchadeq() and peek() throw an Error when the queue is empty. Not handling this can crash the application.
fix
Check queue.isEmpty() before calling deq() or peek().
affects: >=1.0.0
gotchaPackage is CommonJS-only. Using ES6 import syntax (import Queue from 'queuejs') will fail unless your runtime supports require in ESM or you use a bundler.
fix
Use require('queuejs') or use a bundler that handles CommonJS.
affects: >=1.0.0
deprecatedPackage has not been updated since 2018. No TypeScript definitions, no iterator, no concurrency support.
fix
Consider modern alternatives like denque or double-ended-queue for better performance and features.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: queue.enqueue is not a function
Using method name enqueue instead of enq.
fix
queue.enq(element)
Error: Queue is empty
Calling deq() or peek() on an empty queue.
fix
Check isEmpty() before deq/peek: if (!queue.isEmpty()) queue.deq();
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
queuejs — npm install queuejs · libregistry