compose-fn
v0.0.2
Published
A JavaScript library for writing composable functions.
Readme
compose-fn
A JavaScript library for writing composable functions.
Install
npm install --save compose-fnSyntax
compose(initialVal, fn_1[, fn_2, ..., fn_n);compose() takes an initialVal, passing it to fn_1(). The result of which is passed to fn_2(), etc.
Use
var compose = require('compose-fn');
function foo(a) { return a * 2; }
function bar(b) { return b + 1; }
function baz(c) { return c % 3; }
var result = compose(2, foo, bar, baz);
// => 2 