New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fn-compose

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fn-compose

compose an arbitrary number of functions from right to left.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
860
decreased by-20.37%
Maintainers
1
Weekly downloads
 
Created
Source

fn-compose

A simple function to compose an arbitrary number of functions from right to left, or left to right.

install

npm install --save fn-compose

usage

var compose = require('fn-compose'),
	mul2 = function mul2(a){ return a * 2 },
	sub1 = function sub1(a){ return a - 1 },
	mul2Sub1 = compose(sub1, mul2);

mul2Sub1(5); //=> 9

There is also a left to right mode, which is exported as ltr:

var compose = require('fn-compose').ltr, // Notice the .ltr
	mul2 = function mul2(a){ return a * 2 },
	sub1 = function sub1(a){ return a - 1 },
	mul2Sub1 = compose(sub1, mul2);

mul2Sub1(5); //=> 8

license

MIT

Keywords

FAQs

Package last updated on 30 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc