Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Control flow ala ES7 async/await using ES6 generator (thanks to tj/co) with async.js (v2) signatures
async-co provide javascript async/await (through ES6 generator & co) equivalent signatures of the excellent async workflow library.
Module are exported in standard commonJS module format and written in pure ES5/ES6 strict format. (no transpilation required nor used). Use browserify if you need async-co modules in a browser environnement.
async-co is not a wrapper on async, but rather leverages the full potential of native async/await & promises contract. Code tend to be small & very efficient (far more simplier than using callbacks), just give async-co/queue.js a look
Nothing special here
// = eachLimit concurrency = 1
// = eachLimit concurrency = arr.length
Nothing special here neither
// = eachOfLimit concurrency = 1
// = eachOfLimit concurrency = dict.length
const eachLimit = require('async-co/eachLimit');
co(function *() {
var stuffs = [1,2,3, 5, 7]
yield eachLimit(stuffs, 2, function*(id){
yield dootherStuffs(id);
});
});
Call a function in javascript next tick (using setImmediate API, or timeout 0 pollyfill)
Return a QueueObject you can push task into.
Wait for thunk to process task (wait for worker, if needed)
const queue = require('async-co/queue');
const fetch = require('node-fetch');
var q = queue(fetch, 1); //let's be nice
co(function *() {
yield q.push("http://example.com/stuff.json");
});
co(function *() {
yield q.push("http://example.com/otherstuff.json"); //will wait for stuff to be retrieved
});
Throttle any function that return a promise, sugar syntax helper for async-co/queue
const throttle = require('async-co/throttle');
var fetch = require('node-fetch');
fetch = throttle(fetch, 1); //make fetch behave nicely
co(function *() {
yield fetch("http://example.com/stuff.json");
});
co(function *() {
yield fetch("http://example.com/otherstuff.json"); //will wait for stuff.json to be retrieved
});
async-co is tested against async test suite.
async/await, ES6 generators, co, async-co, promise, Promises, yield, async, queue, map, throttle, "Let's have a beer & talk in Paris"
FAQs
Control flow for co with async.js (v2) signatures
The npm package async-co receives a total of 3 weekly downloads. As such, async-co popularity was classified as not popular.
We found that async-co demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.