@f/compose

Right-to-left function composition for two or more functions

Stats

StarsIssuesVersionUpdatedCreatedSize
@f/compose
101.0.16 years ago6 years agoMinified + gzip package size for @f/compose in KB

Readme

compose

Build status Git tag NPM version Code style

Right-to-left function composition for two or more functions.

Function Composition

What is it?

If you aren't familiar with function composition you can read all about it here.

Installation

$ npm install @f/compose

Usage

var compose = require('@f/compose')

var times2plus1 = compose(plus1, times2)
// times2plus1(3) -> 7

function plus1 (x) {
  return x + 1
}

function times2 (x) {
  return x * 2
}

API

compose(...fns)

  • fns - List of functions to compose

Returns: A new function which when called with arguments, pipes those through fns from right-to-left

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.