0.0.2 • Published 10 years ago

lei-pipe v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

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);
});

详细使用方法请参考测试文件。