
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.
Small collection of promise-based queues used in several projects.
npm install --save u-queue
const { queueFactory, singleInstance, sleep, throttlingQueueFactory } = require('u-queue');
Creates simplest queue, that invokes promises one after another.
const queue = queueFactory();
const longProcesses = [
queue(() => sleep(1500).then(() => 1)),
queue(() => sleep(1000).then(() => 2)),
queue(() => sleep(500).then(() => 3)),
];
Promise.all(longProcesses).then(console.log);
// Promise {<pending>}
// => [1, 2, 3]
Same as queueFactory but adds delay after each promise is resolved.
const queue = throttlingQueueFactory({ delay: 1000 });
queue(() => console.log(new Date()));
queue(() => console.log(new Date()));
queue(() => console.log(new Date()));
// Promise {<pending>}
// 11:16:27
// 11:16:28
// 11:16:29
Decorator around async function to run it only once at a time and reuse results for subsequent calls while it's running even if invoked with different arguments.
let start = Date.now();
const f = singleInstance(async (tag) => {
await sleep(1000);
return [ tag, Date.now() - start ];
});
console.log(await Promise.all([f(1), f(2), f(3), f(4)]));
// [ [ 1, 1001 ], [ 1, 1001 ], [ 1, 1001 ], [ 1, 1001 ] ]
console.log(await Promise.all([f(1), f(2), f(3), f(4)]));
// [ [ 1, 2002 ], [ 1, 2002 ], [ 1, 2002 ], [ 1, 2002 ] ]
Creates promise that is resolved after specified milliseconds. Used internally by throttlingQueueFactory, but may be useful somewhere else as well.
sleep(3141).then(console.log);
FAQs
Micro promise-based queues
The npm package u-queue receives a total of 24 weekly downloads. As such, u-queue popularity was classified as not popular.
We found that u-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.