micro-pipe

A small utility for async pipe

micro-pipe

Support for making functions pipeline. Only 549 byte raw file. You can use this both node and browsers.

Install with npm:

npm install micro-pipe
var micropipe = require('micro-pipe');
micropipe(function(next){ console('a'), next()}
          ,function(next){ console('b'), next()}
          ,function(){ console('c')}); // => 'a', 'b', 'c'
var micropipe = require('micro-pipe');
micropipe(function(next){ console('a'), next('b')}
          ,function(v, next){ console(v == 'b'), next('c')}
          ,function(v){ console(v == 'c')}); // => 'a', true, true
var micropipe = require('micro-pipe');
var fns = [];
fns.push(function(next){ console('a'), next()});
fns.push(function(next){ console('b'), next()});
fns.push(function(){ console('c')})
micropipe(fns); // => 'a', 'b', 'c'
<script type="text/javascript" src="micro-pipe.js"></script>
<script type="text/javascript">
 
    micropipe(function(next){ console('x'), next()}
              ,function(next){ console('y'), next()}
              ,function(){ console('z')}); // => 'x', 'y', 'z'
 
</script>