Compose 🚂

@common-utilities/compose 🧰

Typed with TypeScript npm version

Compose is a common function composed of function arguments that returns their value to the next function until returning a final value.

Install

yarn add @common-utilities/compose -D

Usage

const add1 = (val) => val + 1
const subtract2 = (val) => val - 2
const multiplyBy3 = (val) => val * 3
const result = compose(add1, subtract2, multiplyBy3)
// result(3) // 5 (3 + 1 - 3 * 5)

Common Utilities 🧰

No cruft. No bloat. No dependencies.

Simple, typed, functional, documented, and tested javascript utility functions.

View other common utilities on Github.

Last updated

Was this helpful?