
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Queue ADT for browser and nodejs
The Queue class represents a first-in-first-out (FIFO) queue of generic items. It supports the usual enqueue and dequeue operations, along with methods for examining the front of the queue, testing if the queue is empty, and iterating through the items in FIFO order.
Download the production version or the development version.
$ npm install --save queue-adt
$ bower install --save queue-adt
var Queue = require('queue-adt');
var queue = new Queue();
queue.enqueue(10);
queue.first();
queue.isEmpty();
queue.enqueue("foo");
queue.enqueue({hello: "world"});
queue.first().hello; // Outputs "world"
queue.enqueue(function(){ console.log("hello") });
queue.first()(); // Outputs "world"
queue.size();
queue.dequeue();
queue.size();
var itr = queue.iterator;
while(itr.hasNext()) {
console.log(itr.next());
}
queue.empty();
<script type="text/javascript" src="https://raw.githubusercontent.com/pasangsherpa/queue-adt/master/dist/queue-adt.min.js"></script>
<script type="text/javascript">
var queue = new Queue();
queue.enqueue(10);
queue.first();
queue.isEmpty();
queue.enqueue("foo");
queue.enqueue({hello: "world"});
queue.first().hello; // Outputs "world"
queue.enqueue(function(){ console.log("hello") });
queue.first()(); // Outputs "world"
queue.size();
queue.dequeue();
queue.size();
var itr = queue.iterator;
while(itr.hasNext()) {
console.log(itr.next());
}
queue.empty();
</script>
Creates an empty queue with infinite capacity.
Creates an empty queue using the specified capacity.
Type: int
initialCapacity represents the specified capacity.
throws "Queue is full" errorAdds an element to the rear of the queue and returns the new size of the queue.
Type: object
the element to be added to the queue.
throws "Queue is empty" errorRemoves an element from the front of the queue and returns the element.
Type: object
the element removed from the front of the queue.
throws "Queue is empty" errorReturns without removing the element at the front of the queue.
Type: object
the element at the front of the queue.
Returns true if this queue contains no elements.
Type: boolean
whether or not the queue is empty.
Returns the number of elements in the queue.
Type: int
the number of element in the queue.
Removes all element from the the queue and returns the new size of the queue.
Returns an iterator to the queue that iterates through the items in FIFO order.
Type: object
the iterator object of the queue
throws "No such element" errorReturns the next item in FIFO order.
Returns whether the queue has next item in FIFO order.
FAQs
Queue ADT for browser and nodejs
We found that queue-adt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.