fj-compose

1.1.0 • Public • Published

fj-compose

Build Status npm version

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

/fj-compose/

    Package Sidebar

    Install

    npm i fj-compose

    Weekly Downloads

    25

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • hemanth
    • stoeffel