Skip to content

fp-js/fj-pipe

Repository files navigation

fj-pipe

Build Status npm version

pipe with ease.

Installation

npm install fj-pipe --save

Usage

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