Skip to content

fp-js/fj-compose

Repository files navigation

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

About

Compose functions with ease.

Resources

Stars

Watchers

Forks

Packages

No packages published