mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Bump to v4.0.0.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import LodashWrapper from './LodashWrapper';
|
||||
import baseFlatten from './baseFlatten';
|
||||
import getData from './getData';
|
||||
import getFuncName from './getFuncName';
|
||||
import isArray from '../lang/isArray';
|
||||
import isArray from '../isArray';
|
||||
import isLaziable from './isLaziable';
|
||||
import rest from '../rest';
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var CURRY_FLAG = 8,
|
||||
@@ -24,23 +26,26 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
* @returns {Function} Returns the new flow function.
|
||||
*/
|
||||
function createFlow(fromRight) {
|
||||
return function() {
|
||||
var wrapper,
|
||||
length = arguments.length,
|
||||
index = fromRight ? length : -1,
|
||||
leftIndex = 0,
|
||||
funcs = Array(length);
|
||||
return rest(function(funcs) {
|
||||
funcs = baseFlatten(funcs);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
var func = funcs[leftIndex++] = arguments[index];
|
||||
var length = funcs.length,
|
||||
index = length,
|
||||
prereq = LodashWrapper.prototype.thru;
|
||||
|
||||
if (fromRight) {
|
||||
funcs.reverse();
|
||||
}
|
||||
while (index--) {
|
||||
var func = funcs[index];
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
|
||||
wrapper = new LodashWrapper([], true);
|
||||
if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
|
||||
var wrapper = new LodashWrapper([], true);
|
||||
}
|
||||
}
|
||||
index = wrapper ? -1 : length;
|
||||
index = wrapper ? index : length;
|
||||
while (++index < length) {
|
||||
func = funcs[index];
|
||||
|
||||
@@ -68,7 +73,7 @@ function createFlow(fromRight) {
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export default createFlow;
|
||||
|
||||
Reference in New Issue
Block a user