Skip to content

Commit

Permalink
fix: modify curry doc (#3398)
Browse files Browse the repository at this point in the history
* fix: modify curry doc
  • Loading branch information
gleguizamon committed Aug 24, 2023
1 parent de77106 commit e07a0d5
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions source/curry.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,7 @@ import curryN from './curryN.js';
* - `g(_, 2)(_, 3)(1)`
*
* Please note that default parameters don't count towards a [function arity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/length)
* and therefore `curry` won't work well with those:
*
* ```
* const h = R.curry((a, b, c = 2) => a + b + c);
*
* h(40);
* //=> function (waits for `b`)
*
* h(39)(1);
* //=> 42
*
* h(1)(2, 3);
* //=> 6
*
* h(1)(2)(7);
* //=> Error! (`3` is not a function!)
* ```
* and therefore `curry` won't work well with those.
*
* @func
* @memberOf R
Expand All @@ -56,11 +40,14 @@ import curryN from './curryN.js';
* @example
*
* const addFourNumbers = (a, b, c, d) => a + b + c + d;
*
* const curriedAddFourNumbers = R.curry(addFourNumbers);
* const f = curriedAddFourNumbers(1, 2);
* const g = f(3);
* g(4); //=> 10
*
* // R.curry not working well with default parameters
* const h = R.curry((a, b, c = 2) => a + b + c);
* h(1)(2)(7); //=> Error! (`3` is not a function!)
*/
var curry = _curry1(function curry(fn) {
return curryN(fn.length, fn);
Expand Down

0 comments on commit e07a0d5

Please sign in to comment.