really-typed-compose
v1.0.1
Published
Definitely typed and simple implementation of function composition
Downloads
4
Maintainers
Readme
Really typed compose
Performs right-to-left function composition. Supports types definitions.
((y → z), (x → y), …, (o → p), ((a, b, …, n) → o)) → ((a, b, …, n) → z)
Usage
npm i -S really-typed-compose
import { compose } from 'really-typed-compose'
const add = (b: number) => (a: number) => a + b;
const multiply = (b: number) => (a: number) => a * b;
const calc = compose(multiply(2), add(2));
calc(0) // 4
calc(1) // 6