compose-function

WebJar for compose-function

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

compose-function
Last Version

Last Version

3.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

compose-function
WebJar for compose-function
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/stoeffel/compose-function

Download compose-function

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/compose-function/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>compose-function</artifactId>
    <version>3.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/compose-function/
implementation 'org.webjars.npm:compose-function:3.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/compose-function/
implementation ("org.webjars.npm:compose-function:3.0.3")
'org.webjars.npm:compose-function:jar:3.0.3'
<dependency org="org.webjars.npm" name="compose-function" rev="3.0.3">
  <artifact name="compose-function" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='compose-function', version='3.0.3')
)
libraryDependencies += "org.webjars.npm" % "compose-function" % "3.0.3"
[org.webjars.npm/compose-function "3.0.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : arity-n jar [1.0.4,2)

Project Modules

There are no modules declared in this project.

Travis npm Dependency Status Coveralls

Compose-Function

Installation | Usage | Related | License


logo by Justin Mezzell

Compose a new function from smaller functions `f(g(x))`

Installation

npm install compose-function --save

Usage

Basic usage

import compose from 'compose-function';

const composition = compose(sqr, add2); // sqr(add2(x))

composition(2) // => 16

compose(sqr, inc)(2); // => 9
compose(inc, sqr)(2); // => 5

with curry

import compose from 'compose-function';
import { curry, _ } from 'curry-this';


const add = (x, y) => x + y;

// add(6, sqr(add(2, x)))
compose(
  add::curry(6),
  sqr,
  add::curry(2),
);

// map(filter(list, even), sqr)
compose(
  map::curry(_, sqr),
  filter::curry(_, even),
)([1,2,3,4,5,6,7,8]) // => [4, 16, 36, 64]

:: huh?

If you’re wondering what the :: thing means, you’d better read this excellent overview by @jussi-kalliokoski or have a look at the function bind syntax proposal. Or checkout the curry-this docs.

Related

License

MIT © Christoph Hermann

Versions

Version
3.0.3