1.0.1 • Published 7 months ago

func-compose v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

func-compose

npm version npm downloads bundle Codecov License JSDocs

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

Usage

Install package:

# npm
npm install func-compose

# yarn
yarn add func-compose

# pnpm
pnpm install func-compose

Import:

// ESM
import { compose } from "func-compose";

// CommonJS
const { compose } = require("func-compose");

function addOne(x) {
  return x + 1;
}

function multiplyByTwo(x) {
  return x * 2;
}

const result = compose(addOne, multiplyByTwo)(2); // 2 * 2 + 1 = 5

Development

  • Clone this repository
  • Install latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with 💛

Published under MIT License.

1.0.1

7 months ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago