A compose function written in TypeScript.
npm install @rikhoffbauer/compose
yarn add @rikhoffbauer/compose
import compose from "@rikhoffbauer/compose";
const add = (right: number) => (left: number) => left + right;
const divide = (divisor: number) => (dividend: number) => dividend / divisor;
const add3AndDivideBy2 = compose(divide(2), add(3));
add3AndDivideBy2(3); // returns 3 ((3 + 3) / 2)
For more information see the API documentation.
Contributions in the form of pull requests and bug reports are appreciated.
Tests are ran using the test
npm script.
Both the functionality of the code at runtime and its types should be tested.
npm test
yarn test