mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Reduce _.mixin with arrayEach.
This commit is contained in:
22
lodash.js
22
lodash.js
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user