update
This commit is contained in:
parent
d9becc67b6
commit
9308795b8b
964 changed files with 104265 additions and 16 deletions
48
node_modules/ramda/src/liftN.js
generated
vendored
Normal file
48
node_modules/ramda/src/liftN.js
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
var _curry2 =
|
||||
/*#__PURE__*/
|
||||
require("./internal/_curry2");
|
||||
|
||||
var _reduce =
|
||||
/*#__PURE__*/
|
||||
require("./internal/_reduce");
|
||||
|
||||
var ap =
|
||||
/*#__PURE__*/
|
||||
require("./ap");
|
||||
|
||||
var curryN =
|
||||
/*#__PURE__*/
|
||||
require("./curryN");
|
||||
|
||||
var map =
|
||||
/*#__PURE__*/
|
||||
require("./map");
|
||||
/**
|
||||
* "lifts" a function to be the specified arity, so that it may "map over" that
|
||||
* many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
|
||||
*
|
||||
* @func
|
||||
* @memberOf R
|
||||
* @since v0.7.0
|
||||
* @category Function
|
||||
* @sig Number -> (*... -> *) -> ([*]... -> [*])
|
||||
* @param {Function} fn The function to lift into higher context
|
||||
* @return {Function} The lifted function.
|
||||
* @see R.lift, R.ap
|
||||
* @example
|
||||
*
|
||||
* const madd3 = R.liftN(3, (...args) => R.sum(args));
|
||||
* madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
|
||||
*/
|
||||
|
||||
|
||||
var liftN =
|
||||
/*#__PURE__*/
|
||||
_curry2(function liftN(arity, fn) {
|
||||
var lifted = curryN(arity, fn);
|
||||
return curryN(arity, function () {
|
||||
return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = liftN;
|
||||
Loading…
Add table
Add a link
Reference in a new issue