Skip to content

An useful function to make a multi params function be called in chains.

Notifications You must be signed in to change notification settings

youngkaneda/curry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Curry any function.

An useful function to make a multi params function be called in chains.

Built with ❤︎ by Kaneda

Instalation

npm install curry-fn

How to use

Normal use

const {curry} from 'curry-fn';

const add = (x, y, z) => x + y + z;
const curriedAdd = curry(add);
console.log(curriedAdd(1)(2)(3));
// if you pass more than one arg, then the function will ignore them.
// unary functions should receive only one parameter.
console.log(curriedAdd(1)(2, 3)(3)); // => 6

Changelog

1.0.0

First release.

1.1.0

Tests added.

1.2.0

For the sake of fudamentalism, I removed somes features, given the fact that unary functions are a requirement in curry, and the potential leading to errors, and misunderstanding about arbitrary parameters sizes in function composition.

Removed features:

  1. Placeholders.
  2. Arbitrary arity.
  3. 1..N parameters per curried function.

Motivation

I just want to write some useful functional code in javascript.

TODO

  1. add tests.
  2. add code coverage.

Feel free to fork and contribute.

About

An useful function to make a multi params function be called in chains.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published