flowleft

0.0.1 • Public • Published

flowleft

Function composition from left to right.

NPM

Install

npm install flowleft
bower install flowleft

Usage

var flowLeft = require('flowleft');
 
function square(n) {
  return n * n;
}
 
function add(/* args */) {
  var result = 0, i = arguments.length;
  while(i--) result += arguments[i];
  return result;
}
 
var addSquare = flowLeft(add, square);
 
console.log(addSquare(1, 2)); // 9
console.log(addSquare(1, 2, 3)); // 36
console.log((addSquare(2)); // 4

Test

npm test

License

MIT

Package Sidebar

Install

npm i flowleft

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • miguelmota