Rename private spread helper to flatSpread.

This commit is contained in:
John-David Dalton
2016-11-16 20:05:15 -08:00
parent 5cb80a0a84
commit eba18891e5

View File

@@ -65,23 +65,24 @@ function createCloner(func) {
}
/**
* This function is like `_.spread` except that it includes arguments after those spread.
* A specialized version of `_.spread` which flattens the spread array into
* the arguments of the invoked `func`.
*
* @private
* @param {Function} func The function to spread arguments over.
* @param {number} start The start position of the spread.
* @returns {Function} Returns the new function.
*/
function spread(func, start) {
function flatSpread(func, start) {
return function() {
var length = arguments.length,
lastIndex = length - 1,
args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var array = args[start],
lastIndex = args.length - 1,
otherArgs = args.slice(0, start);
if (array) {
@@ -313,7 +314,7 @@ function baseConvert(util, name, func, options) {
var data = mapping.methodSpread[name],
start = data && data.start;
return start === undefined ? ary(func, n) : spread(func, start);
return start === undefined ? ary(func, n) : flatSpread(func, start);
}
return func;
}
@@ -483,8 +484,8 @@ function baseConvert(util, name, func, options) {
each(aryMethodKeys, function(aryKey) {
each(mapping.aryMethod[aryKey], function(otherName) {
if (realName == otherName) {
var spreadData = mapping.methodSpread[realName],
afterRearg = spreadData && spreadData.afterRearg;
var data = mapping.methodSpread[realName],
afterRearg = data && data.afterRearg;
result = afterRearg
? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey)