fj-compose
v1.1.0
Published
Compose functions with ease.
Downloads
258
Readme
fj-compose
Compose with ease.
Installation
npm install fj-compose --save
Usage
var compose = require('fj-compose');
const add1 = (x) => x + 1,
mult2 = (x) => x * 2,
square = (x) => x * x;
const compose1 = compose(add1),
compose2 = compose(mult2, add1),
compose3 = compose(square, mult2, add1);
compose1(0); // 1
// === add1(0)
compose2(1); // 4
// === mult2(add1(0))
compose3(1); // 16
// === square(mult2(add1(0)))