@rikhoffbauer/compose
Options
All
  • Public
  • Public/Protected
  • All
Menu

@rikhoffbauer/compose

coverage build npm version

A compose function written in TypeScript.

Installing

Using npm

npm install @rikhoffbauer/compose

Using yarn

yarn add @rikhoffbauer/compose

Usage

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.

Contributing

Contributions in the form of pull requests and bug reports are appreciated.

Running tests

Tests are ran using the test npm script. Both the functionality of the code at runtime and its types should be tested.

Using npm

npm test

Using yarn

yarn test

Index

External modules