Remove forEach dep from mixin.

This commit is contained in:
John-David Dalton
2014-01-01 23:10:27 -06:00
parent 3e4f9451a0
commit 7beb204b9d
7 changed files with 159 additions and 141 deletions

View File

@@ -6432,7 +6432,6 @@
if (options == null) {
options = source;
}
ctor = lodashWrapper;
source = object;
object = lodash;
methodNames = functions(source);
@@ -6442,30 +6441,35 @@
} else if (isObject(options) && 'chain' in options) {
chain = options.chain;
}
var ctor = object,
isFunc = isFunction(ctor);
var index = -1,
isFunc = isFunction(object),
length = methodNames ? methodNames.length : 0;
while (++index < length) {
var methodName = methodNames[index],
func = object[methodName] = source[methodName];
forEach(methodNames, function(methodName) {
var func = object[methodName] = source[methodName];
if (isFunc) {
ctor.prototype[methodName] = function() {
var chainAll = this.__chain__,
value = this.__wrapped__,
args = [value];
object.prototype[methodName] = (function(func) {
return function() {
var chainAll = this.__chain__,
value = this.__wrapped__,
args = [value];
push.apply(args, arguments);
var result = func.apply(object, args);
if (chain || chainAll) {
if (value === result && isObject(result)) {
return this;
push.apply(args, arguments);
var result = func.apply(object, args);
if (chain || chainAll) {
if (value === result && isObject(result)) {
return this;
}
result = new object(result);
result.__chain__ = chainAll;
}
result = new ctor(result);
result.__chain__ = chainAll;
}
return result;
};
return result;
};
}(func));
}
});
}
}
/**