awinogradov / really-typed-compose

Definitely typed and simple implementation of function composition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Licence MIT

About

Definitely typed and simple implementation of function composition


Languages

Language:TypeScript 100.0%