Apply spread arguments transform.

This commit is contained in:
John-David Dalton
2017-01-06 15:42:44 -08:00
parent 7167d7e09f
commit f4a6e9ede9
5 changed files with 5 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ function baseDelay(func, wait, args) {
if (typeof func != 'function') { if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT); throw new TypeError(FUNC_ERROR_TEXT);
} }
return setTimeout(() => func.apply(undefined, args), wait); return setTimeout(() => func(...args), wait);
} }
export default baseDelay; export default baseDelay;

View File

@@ -50,7 +50,7 @@ function createFlow(fromRight) {
data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
!data[4].length && data[9] == 1 !data[4].length && data[9] == 1
) { ) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); wrapper = wrapper[getFuncName(data[0])](...data[3]);
} else { } else {
wrapper = (func.length == 1 && isLaziable(func)) wrapper = (func.length == 1 && isLaziable(func))
? wrapper[funcName]() ? wrapper[funcName]()

View File

@@ -45,7 +45,7 @@ function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials,
newHoldersRight, argPos, ary, arity newHoldersRight, argPos, ary, arity
]; ];
var result = wrapFunc.apply(undefined, newData); var result = wrapFunc(...newData);
if (isLaziable(func)) { if (isLaziable(func)) {
setData(result, newData); setData(result, newData);
} }

View File

@@ -97,7 +97,7 @@ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arit
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
result = createPartial(func, bitmask, thisArg, partials); result = createPartial(func, bitmask, thisArg, partials);
} else { } else {
result = createHybrid.apply(undefined, newData); result = createHybrid(...newData);
} }
var setter = data ? baseSetData : setData; var setter = data ? baseSetData : setData;
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);

View File

@@ -30,7 +30,7 @@ function shortOut(func) {
} else { } else {
count = 0; count = 0;
} }
return func.apply(undefined, arguments); return func(...arguments);
}; };
} }