source: node_modules/ramda/src/lift.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: 1017 bytes
Line 
1var _curry1 =
2/*#__PURE__*/
3require("./internal/_curry1.js");
4
5var liftN =
6/*#__PURE__*/
7require("./liftN.js");
8/**
9 * "lifts" a function of arity >= 1 so that it may "map over" a list, Function or other
10 * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
11 *
12 * @func
13 * @memberOf R
14 * @since v0.7.0
15 * @category Function
16 * @sig (*... -> *) -> ([*]... -> [*])
17 * @param {Function} fn The function to lift into higher context
18 * @return {Function} The lifted function.
19 * @see R.liftN
20 * @example
21 *
22 * const madd3 = R.lift((a, b, c) => a + b + c);
23 *
24 * madd3([100, 200], [30, 40], [5, 6, 7]); //=> [135, 136, 137, 145, 146, 147, 235, 236, 237, 245, 246, 247]
25 *
26 * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
27 *
28 * madd5([10, 20], [1], [2, 3], [4], [100, 200]); //=> [117, 217, 118, 218, 127, 227, 128, 228]
29 */
30
31
32var lift =
33/*#__PURE__*/
34_curry1(function lift(fn) {
35 return liftN(fn.length, fn);
36});
37
38module.exports = lift;
Note: See TracBrowser for help on using the repository browser.