update
This commit is contained in:
parent
d9becc67b6
commit
9308795b8b
964 changed files with 104265 additions and 16 deletions
42
node_modules/ramda/es/internal/_curryN.js
generated
vendored
Normal file
42
node_modules/ramda/es/internal/_curryN.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
import _arity from "./_arity.js";
|
||||
import _isPlaceholder from "./_isPlaceholder.js";
|
||||
/**
|
||||
* Internal curryN function.
|
||||
*
|
||||
* @private
|
||||
* @category Function
|
||||
* @param {Number} length The arity of the curried function.
|
||||
* @param {Array} received An array of arguments received thus far.
|
||||
* @param {Function} fn The function to curry.
|
||||
* @return {Function} The curried function.
|
||||
*/
|
||||
|
||||
export default function _curryN(length, received, fn) {
|
||||
return function () {
|
||||
var combined = [];
|
||||
var argsIdx = 0;
|
||||
var left = length;
|
||||
var combinedIdx = 0;
|
||||
|
||||
while (combinedIdx < received.length || argsIdx < arguments.length) {
|
||||
var result;
|
||||
|
||||
if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
|
||||
result = received[combinedIdx];
|
||||
} else {
|
||||
result = arguments[argsIdx];
|
||||
argsIdx += 1;
|
||||
}
|
||||
|
||||
combined[combinedIdx] = result;
|
||||
|
||||
if (!_isPlaceholder(result)) {
|
||||
left -= 1;
|
||||
}
|
||||
|
||||
combinedIdx += 1;
|
||||
}
|
||||
|
||||
return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue