source: node_modules/ramda-adjunct/lib/curryRightN.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _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 */
26var 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});
34var _default = curryRightN;
35exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.