Skip to content

Definitely typed and simple implementation of function composition

Notifications You must be signed in to change notification settings

awinogradov/really-typed-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

Stars

Watchers

Forks

Packages