0.5.0 • Published 9 years ago

bacon-trans v0.5.0

Weekly downloads
1
License
MIT
Repository
-
Last release
9 years ago

npm version

bacon-trans

Stream chaining library like a transducers for Bacon.js.

Getting it

Installation for node projects

npm install --save baconjs
npm install --save bacon-trans

and load in your node programs.

var Bacon = require('baconjs');
var t = require('bacon-trans');

Load for web browser.

<script src="bacon-trans-web.js"></script>
<script>
var Bacon = require('baconjs');
var t = require('bacon-trans');
</script>

usage

Basic

// combination of method and callback can be assigned to valiables.
var square = t.map(function(x){ return x*x; }); 
var isEven = t.filter(function(x){ return x%2 === 0; }); 
var log    = t.onValue(console,'log');

// create stream
var stream = t(square, isEven, log);

var arr = new Bacon.fromArray([1,2,3,4,5,6,7,8,9]);

// applying
stream(arr);

// reuse stream any number of times.
var arr2 = new Bacon.fromArray([11,12,13,14,15,16,17,18,19,20]);
stream(arr2);

// create stream of another combination
var stream2 = t(isEven, square);

// joining stream
var stream3 = t(stream2, log);

var arr3 = new Bacon.fromArray([1,2,3,4,5,6,7,8,9]);

// applying
stream3(arr3);
0.5.0

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago