After
Invoke callback after n calls
Status: production ready
Example
var after = var db = // some db. var { // use after to run two tasks in parallel, // namely get request body and get session // then run updateUser with the results var next = var results = {} // now do the thing! { if err resstatusCode = 500 return res if !resultuser || resultuserrole !== "admin" resstatusCode = 403 return res db }}
Naive Example
var after = next = // it works { console}
Example with error handling
var after = next = // logs oops // does nothing // This callback is only called once.// If there is an error the callback gets called immediately// this avoids the situation where errors get lost. { console}
Installation
npm install after
Tests
npm test
Contributors
- Raynos
- defunctzombie