
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Queue data structure implementation in javascript.
While you can mimic queue(FIFO) behavior via arrays like so:
const arr = [];
// "queue" some data up
arr.push(1);
arr.push(2);
arr.push(3);
console.log(arr.shift()) // 1
This operation causes the array indices to be recalculated resulting in O(n) time for each dequeue made (push is 0(1) time operation).
To avoid O(n) dequeue times we can instead use a hash table and keep track of of head and tail indexes of the table. This allows enqueue and dequeue to operate in O(1) time!
Check out index.js to see a very simple implementation of this behavior.
npm install jsQueue
const q = new Queue();
// NOTE: enqueue returns the queue object so we can chain enqueue methods
q.enqueue('some').enqueue('test').enqueue('data');
console.log(q.dequeue()) // 'some'
console.log(q.dequeue()) // 'test'
console.log(q.dequeue()) // 'data'
console.log(q.dequeue()) // false
console.log(q.size) // 0
q.enqueue('something');
// peek lets us check whats next without dequeuing it
console.log(q.peek()) // 'something'
q.enqueue('some').enqueue('more').enqueue.('data');
console.log(q.size) // 4
FAQs
Simple queue data structure for javascript
The npm package jsQueue receives a total of 1 weekly downloads. As such, jsQueue popularity was classified as not popular.
We found that jsQueue 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.