
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
Efficient fifo queue for handling large amounts of data in O(1)
This module was created because most other queue modules in javascript either use simple arrays or doubly linked lists.
Both have drawbacks: Large arrays are terribly inefficient when removing the first element and linked lists are not very efficent storage-wise.
import Queue from 'std-queue';
const queue = new Queue();
queue.push(1);
queue.push(2);
for (let i = 10; i < 10000; i++) {
queue.push(i);
}
queue.push('Hello', 'World');
queue.peek(); // 1
queue.last(); // 'World';
queue.shift(); // 1, head is now at 2
queue.length; // 9993
queue.clear(); // Empties queue
queue.shift(); // undefined
The underlying implementation is a simple linked list of subqueues (delayed shift arrays) of maximum size 1000 each.
The only operations performed are:
Each of those operations are O(1), there is never any array resizing. The use of arrays instead of just linked lists allow to be faster and use less RAM than linked lists.
If you have contributions or feature requests, open a pull request or create a new issue. I will glady add basic features if they are needed.
FAQs
Efficient fifo queue for handling large amounts of data in O(1)
The npm package std-queue receives a total of 9 weekly downloads. As such, std-queue popularity was classified as not popular.
We found that std-queue 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.