lei-pipe
v0.0.2
Published
pipe
Downloads
5
Readme
node-lei-pipe
流水线式执行一系列函数,可指定简单的依赖关系
var Pipe = require('lei-pipe');
var p = new Pipe();
p.add(function (data, next) {
// ...
next();
});
p.add('a', function (data, next) {
// ...
next();
});
p.add({before: ['a']}, function (data, next) {
// ...
next();
});
p.add('b', {after: ['a']}, function (data, next) {
// ...
next();
});
p.start(123, function (err, data) {
if (err) throw err;
console.log(data);
});
详细使用方法请参考测试文件。