fj-pipe
Version:
Pipe functions, FP style.
33 lines (21 loc) • 591 B
Markdown
[](https://travis-ci.org/fp-js/fj-pipe) [](http://badge.fury.io/js/fj-pipe)
> pipe with ease.
`npm install fj-pipe --save`
```js
var pipe = require('fj-pipe');
const add1 = (x) => x + 1,
mult2 = (x) => x * 2,
square = (x) => x * x;
const pipe1 = pipe(add1),
pipe2 = pipe(add1, mult2),
pipe3 = pipe(add1, mult2, square);
pipe1(0); // 1
// === add1(0)
pipe2(1); // 4
// === mult2(add1(0))
pipe3(1); // 16
// === square(mult2(add1(0)))
```