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