Reduce _.mixin with arrayEach.

This commit is contained in:
John-David Dalton
2015-08-04 22:29:30 -07:00
parent fa7ebb36dc
commit 4a4badcdc1

View File

@@ -10784,19 +10784,12 @@
methodNames = baseFunctions(source, keys(source)); methodNames = baseFunctions(source, keys(source));
} }
var chain = (isObject(options) && 'chain' in options) ? options.chain : true, var chain = (isObject(options) && 'chain' in options) ? options.chain : true,
index = -1, isFunc = isFunction(object);
isFunc = isFunction(object),
length = methodNames.length;
while (++index < length) { arrayEach(methodNames, function(methodName) {
var methodName = methodNames[index], var func = source[methodName];
func = source[methodName]; object[methodName] = func;
if (isFunc) {
(function(func) {
object[methodName] = func;
if (!isFunc) {
return;
}
object.prototype[methodName] = function() { object.prototype[methodName] = function() {
var chainAll = this.__chain__; var chainAll = this.__chain__;
if (chain || chainAll) { if (chain || chainAll) {
@@ -10809,8 +10802,9 @@
} }
return func.apply(object, arrayPush([this.value()], arguments)); return func.apply(object, arrayPush([this.value()], arguments));
}; };
}(func)); }
} });
return object; return object;
} }