mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 19:37:49 +00:00
Cleanup createFlow.
This commit is contained in:
@@ -3515,11 +3515,8 @@
|
|||||||
*/
|
*/
|
||||||
function createFlow(fromRight) {
|
function createFlow(fromRight) {
|
||||||
return function() {
|
return function() {
|
||||||
var length = arguments.length;
|
|
||||||
if (!length) {
|
|
||||||
return function() { return arguments[0]; };
|
|
||||||
}
|
|
||||||
var wrapper,
|
var wrapper,
|
||||||
|
length = arguments.length,
|
||||||
index = fromRight ? length : -1,
|
index = fromRight ? length : -1,
|
||||||
leftIndex = 0,
|
leftIndex = 0,
|
||||||
funcs = Array(length);
|
funcs = Array(length);
|
||||||
@@ -3529,15 +3526,17 @@
|
|||||||
if (typeof func != 'function') {
|
if (typeof func != 'function') {
|
||||||
throw new TypeError(FUNC_ERROR_TEXT);
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
}
|
}
|
||||||
var funcName = wrapper ? '' : getFuncName(func);
|
if (!wrapper && getFuncName(func) == 'wrapper') {
|
||||||
wrapper = funcName == 'wrapper' ? new LodashWrapper([]) : wrapper;
|
wrapper = new LodashWrapper([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
index = wrapper ? -1 : length;
|
index = wrapper ? -1 : length;
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
func = funcs[index];
|
func = funcs[index];
|
||||||
funcName = getFuncName(func);
|
|
||||||
|
|
||||||
var data = funcName == 'wrapper' ? getData(func) : null;
|
var funcName = getFuncName(func),
|
||||||
|
data = funcName == 'wrapper' ? getData(func) : null;
|
||||||
|
|
||||||
if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
|
if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
|
||||||
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
||||||
} else {
|
} else {
|
||||||
@@ -3550,7 +3549,7 @@
|
|||||||
return wrapper.plant(args[0]).value();
|
return wrapper.plant(args[0]).value();
|
||||||
}
|
}
|
||||||
var index = 0,
|
var index = 0,
|
||||||
result = funcs[index].apply(this, args);
|
result = length ? funcs[index].apply(this, args) : args[0];
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
result = funcs[index].call(this, result);
|
result = funcs[index].call(this, result);
|
||||||
|
|||||||
Reference in New Issue
Block a user