1 | var _curry1 =
|
2 | /*#__PURE__*/
|
3 | require("./internal/_curry1");
|
4 |
|
5 | var curryN =
|
6 | /*#__PURE__*/
|
7 | require("./curryN");
|
8 | /**
|
9 | * Returns a curried equivalent of the provided function. The curried function
|
10 | * has two unusual capabilities. First, its arguments needn't be provided one
|
11 | * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the
|
12 | * following are equivalent:
|
13 | *
|
14 | * - `g(1)(2)(3)`
|
15 | * - `g(1)(2, 3)`
|
16 | * - `g(1, 2)(3)`
|
17 | * - `g(1, 2, 3)`
|
18 | *
|
19 | * Secondly, the special placeholder value [`R.__`](#__) may be used to specify
|
20 | * "gaps", allowing partial application of any combination of arguments,
|
21 | * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__),
|
22 | * the following are equivalent:
|
23 | *
|
24 | * - `g(1, 2, 3)`
|
25 | * - `g(_, 2, 3)(1)`
|
26 | * - `g(_, _, 3)(1)(2)`
|
27 | * - `g(_, _, 3)(1, 2)`
|
28 | * - `g(_, 2)(1)(3)`
|
29 | * - `g(_, 2)(1, 3)`
|
30 | * - `g(_, 2)(_, 3)(1)`
|
31 | *
|
32 | * @func
|
33 | * @memberOf R
|
34 | * @since v0.1.0
|
35 | * @category Function
|
36 | * @sig (* -> a) -> (* -> a)
|
37 | * @param {Function} fn The function to curry.
|
38 | * @return {Function} A new, curried function.
|
39 | * @see R.curryN, R.partial
|
40 | * @example
|
41 | *
|
42 | * const addFourNumbers = (a, b, c, d) => a + b + c + d;
|
43 | *
|
44 | * const curriedAddFourNumbers = R.curry(addFourNumbers);
|
45 | * const f = curriedAddFourNumbers(1, 2);
|
46 | * const g = f(3);
|
47 | * g(4); //=> 10
|
48 | */
|
49 |
|
50 |
|
51 | var curry =
|
52 | /*#__PURE__*/
|
53 | _curry1(function curry(fn) {
|
54 | return curryN(fn.length, fn);
|
55 | });
|
56 |
|
57 | module.exports = curry; |
\ | No newline at end of file |