UNPKG

952 BJavaScriptView Raw
1var _curry1 =
2/*#__PURE__*/
3require("./internal/_curry1");
4
5var liftN =
6/*#__PURE__*/
7require("./liftN");
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([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
25 *
26 * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
27 *
28 * madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24]
29 */
30
31
32var lift =
33/*#__PURE__*/
34_curry1(function lift(fn) {
35 return liftN(fn.length, fn);
36});
37
38module.exports = lift;
\No newline at end of file