Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

miguelmota/flowright

Repository files navigation

flowright

Function composition from right to left.

NPM

Install

npm install flowright
bower install flowright

Usage

var flowRight = require('flowright');

function square(n) {
  return n * n;
}

function add(/* args */) {
  var result = 0, i = arguments.length;
  while(i--) result += arguments[i];
  return result;
}

var addSquare = flowRight(square, add);

console.log(addSquare(1, 2)); // 9
console.log(addSquare(1, 2, 3)); // 36
console.log((addSquare(2)); // 4

Test

npm test

License

MIT

About

Function composition from right to left.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published