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