Callback ops
Just a few callback wrappers to abstract out common result or error wrangling code.
Installation
npm install callback-ops
Usage
var co = ;
return(results..., callback)
Alias: result.
Overwrites return value(s) passed to a callback. Errors are propagated unchanged.
{ // Create query var query = db; // Run query, but ignore its result, pass number or links inserted instead query;}
Can be used to completely strip results:
// Run query, but don't pass it result to callbackquery;
select(keys..., callback)
Select part of result passed to callback.
keys
could be strings for object properties or numbers for array indexes.
// Pass func2 result to callbackasync // Select .rows[0].name from result before passing to callbackclient
fallback(defaultValue, callback)
Passes default to callback instead of error.