mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Remove forEach dep from mixin.
This commit is contained in:
44
lodash.js
44
lodash.js
@@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user