[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | /**
|
---|
| 7 | * Returns a curried equivalent of the provided function, with the specified arity.
|
---|
| 8 | * This function is like curryN, except that the provided arguments order is reversed.
|
---|
| 9 | *
|
---|
| 10 | * @func curryRightN
|
---|
| 11 | * @memberOf RA
|
---|
| 12 | * @since {@link https://char0n.github.io/ramda-adjunct/1.12.0|v1.12.0}
|
---|
| 13 | * @category Function
|
---|
| 14 | * @sig Number -> (* -> a) -> (* -> a)
|
---|
| 15 | * @param {number} length The arity for the returned function
|
---|
| 16 | * @param {Function} fn The function to curry
|
---|
| 17 | * @return {Function} A new, curried function
|
---|
| 18 | * @see {@link http://ramdajs.com/docs/#curryN|R.curryN}, {@link RA.curryRight|curryRight}
|
---|
| 19 | * @example
|
---|
| 20 | *
|
---|
| 21 | * const concatStrings = (a, b, c) => a + b + c;
|
---|
| 22 | * const concatStringsCurried = RA.curryRightN(3, concatStrings);
|
---|
| 23 | *
|
---|
| 24 | * concatStringCurried('a')('b')('c'); // => 'cba'
|
---|
| 25 | */
|
---|
| 26 | var curryRightN = (0, _ramda.curryN)(2, function (arity, fn) {
|
---|
| 27 | return (0, _ramda.curryN)(arity, function wrapper() {
|
---|
| 28 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
---|
| 29 | args[_key] = arguments[_key];
|
---|
| 30 | }
|
---|
| 31 | return fn.apply(this, (0, _ramda.reverse)(args));
|
---|
| 32 | });
|
---|
| 33 | });
|
---|
| 34 | var _default = curryRightN;
|
---|
| 35 | exports["default"] = _default; |
---|