Compose π
Last updated
Was this helpful?
Last updated
Was this helpful?
Compose is a common function composed of function arguments that returns their value to the next function until returning a final value.
yarn add @common-utilities/compose -D
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)
No cruft. No bloat. No dependencies.
Simple, typed, functional, documented, and tested javascript utility functions.
View other common utilities on Github.