1.0.1 • Published 7 years ago

@typed/curry v1.0.1

Weekly downloads
1,229
License
MIT
Repository
github
Last release
7 years ago

@typed/curry

A typescript version of curry for functional programming

Let me have it

npm install --save @typed/curry
# or
yarn add @typed/curry

One caveat is that it only accepts functions of arity 5 or less, as I believe functions with more than 3, and especially 5, parameters to be an anti-pattern.

Basic usage

import { curry } from '@typed/curry';

const add = curry((a: number, b: number) => a + b);

const add1 = add(1);
const add2 = add(2);

console.log(add1(5)) // 6
console.log(add2(5)) // 7