Curry any function.
An useful function to make a multi params function be called in chains.
Built with ❤︎ by Kaneda
npm install curry-fn
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
First release.
Tests added.
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:
- Placeholders.
- Arbitrary arity.
- 1..N parameters per curried function.
I just want to write some useful functional code in javascript.
add tests.- add code coverage.
Feel free to fork and contribute.