1 | var _curry1 =
|
2 | /*#__PURE__*/
|
3 | require("./internal/_curry1");
|
4 |
|
5 | var nAry =
|
6 | /*#__PURE__*/
|
7 | require("./nAry");
|
8 | /**
|
9 | * Wraps a function of any arity (including nullary) in a function that accepts
|
10 | * exactly 2 parameters. Any extraneous parameters will not be passed to the
|
11 | * supplied function.
|
12 | *
|
13 | * @func
|
14 | * @memberOf R
|
15 | * @since v0.2.0
|
16 | * @category Function
|
17 | * @sig (* -> c) -> (a, b -> c)
|
18 | * @param {Function} fn The function to wrap.
|
19 | * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
|
20 | * arity 2.
|
21 | * @see R.nAry, R.unary
|
22 | * @example
|
23 | *
|
24 | * const takesThreeArgs = function(a, b, c) {
|
25 | * return [a, b, c];
|
26 | * };
|
27 | * takesThreeArgs.length; //=> 3
|
28 | * takesThreeArgs(1, 2, 3); //=> [1, 2, 3]
|
29 | *
|
30 | * const takesTwoArgs = R.binary(takesThreeArgs);
|
31 | * takesTwoArgs.length; //=> 2
|
32 | * // Only 2 arguments are passed to the wrapped function
|
33 | * takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]
|
34 | * @symb R.binary(f)(a, b, c) = f(a, b)
|
35 | */
|
36 |
|
37 |
|
38 | var binary =
|
39 | /*#__PURE__*/
|
40 | _curry1(function binary(fn) {
|
41 | return nAry(2, fn);
|
42 | });
|
43 |
|
44 | module.exports = binary; |
\ | No newline at end of file |