0.0.2 • Published 10 years ago

compose-fn v0.0.2

Weekly downloads
3
License
ISC
Repository
-
Last release
10 years ago

compose-fn

A JavaScript library for writing composable functions.

Install

npm install --save compose-fn

Syntax

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