0.3.0 • Published 9 years ago

pipe-piper v0.3.0

Weekly downloads
-
License
ISC
Repository
-
Last release
9 years ago

pipe-piper

Attach a series of actions to carry out on data (middleware / pipeline pattern)

Installation

npm install pipe-piper

Example Usage

var Pipe = require('pipe-piper');
var pipe = Pipe.create({testStr : 'Before Start'});
var action1 = function (err, data, next) {
		data.testStr = 'test started';
		next(undefined, data, next)
	};
	var action2 = function (err, data, next) {
		data.testStr = 'process complete';
		next(err, data, next);
	};
pipe.use(action1);
pipe.use(action2);
pipe.on('start', function (data) {
  console.log(data); // Before Start
});
pipe.on('complete', function (data) {
  console.log(data); // Process Complete
});

//Start Pipeline
pipe.start();