source: node_modules/ramda/src/liftN.js@ d24f17c

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

Initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2.js");
4
5var _arrayReduce =
6/*#__PURE__*/
7require("./internal/_arrayReduce.js");
8
9var ap =
10/*#__PURE__*/
11require("./ap.js");
12
13var curryN =
14/*#__PURE__*/
15require("./curryN.js");
16
17var map =
18/*#__PURE__*/
19require("./map.js");
20/**
21 * "lifts" a function to be the specified arity, so that it may "map over" that
22 * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
23 *
24 * @func
25 * @memberOf R
26 * @since v0.7.0
27 * @category Function
28 * @sig Number -> (*... -> *) -> ([*]... -> [*])
29 * @param {Function} fn The function to lift into higher context
30 * @return {Function} The lifted function.
31 * @see R.lift, R.ap
32 * @example
33 *
34 * const madd3 = R.liftN(3, (...args) => R.sum(args));
35 * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
36 */
37
38
39var liftN =
40/*#__PURE__*/
41_curry2(function liftN(arity, fn) {
42 var lifted = curryN(arity, fn);
43 return curryN(arity, function () {
44 return _arrayReduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
45 });
46});
47
48module.exports = liftN;
Note: See TracBrowser for help on using the repository browser.