
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
serialize-async
Advanced tools
Serialize execution of javascript asynchronous functions. Typically those functions have their own async callback where either next(mem) can start the next function, or if error, fail() to abort. The variable "mem" is accessible all the way through
$ npm install --save serialize-async
const serialize = require('serialize-async');
serialize( {init mem} , [
function (mem, next, fail) {
// receive the init mem, and start the first job
asyncFun1(
...,
function cb(result){
mem.result = result // update mem in place ...
next(mem); // start the next job
}
);
},
function (mem, next, fail) {
// job2 started by the previous next(mem), certainly receive the updated mem
asyncFun2(
...,
function cb(err, result){
if (err) {
fail(err); // if anything wrong, cancel the rest of jobs
return;
}
...
next(mem); // move on
}
);
},
...
]).then((mem)=>{
// when all job call next(mem), the latest mem get here
...
}).catch((err)=>{
// as long as one fail() call
...
}).finally(()=>{
// Thanks bluebird. Yes, serialize() return bluebird promise
...
})
serialize(init, [fn1, fn2 ...]): Promise
MIT ©
FAQs
Serialize execution of javascript asynchronous functions
We found that serialize-async 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.