runn
v0.0.2
Published
Versitale and easy to use funciton running
Downloads
44
Readme
Runner
Middleware style function invocation, run a series of asynchronus functions in order.
Example
var Runn = require('runn');
var run = new Runn();
run.before(function(data, done){
data.foo = 'bar';
asyncOp(function(err, data){
done(err);
});
}, function(data, done){
data = syncOp(data);
done();
});
run.middle(function(data, done){
db.update(query, data, function(err, data){
data = data;
done(err);
});
});
run.after(function(data, done){
data = translateObj(data);
done();
});
run.exec({foo:'bar'}, function(err, data){
console.log(err); // boolean
console.log(data); // your data
});