https://github.com/youngkaneda/curry
An useful function to make a multi params function be called in chains.
https://github.com/youngkaneda/curry
functional-programming javascript
Last synced: 4 months ago
JSON representation
An useful function to make a multi params function be called in chains.
- Host: GitHub
- URL: https://github.com/youngkaneda/curry
- Owner: youngkaneda
- Created: 2020-05-27T16:29:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T07:13:33.000Z (almost 3 years ago)
- Last Synced: 2023-10-07T11:20:16.674Z (about 2 years ago)
- Topics: functional-programming, javascript
- Language: JavaScript
- Homepage:
- Size: 683 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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.