Cleanup _.mixin.

This commit is contained in:
John-David Dalton
2015-01-02 10:23:16 -06:00
parent 6a87ed2853
commit dff35bc9b7

View File

@@ -10146,30 +10146,31 @@
* // => ['e']
*/
function mixin(object, source, options) {
var chain = true,
isObj = isObject(source),
noOpts = options == null,
props = noOpts && isObj && keys(source),
methodNames = props && baseFunctions(source, props);
if (options == null) {
var isObj = isObject(source),
props = isObj && keys(source),
methodNames = props && props.length && baseFunctions(source, props);
if ((props && props.length && !methodNames.length) || (noOpts && !isObj)) {
if (noOpts) {
if (!(methodNames ? methodNames.length : isObj)) {
methodNames = false;
options = source;
source = object;
object = this;
}
methodNames = false;
source = object;
object = this;
}
methodNames || (methodNames = baseFunctions(source, keys(source)));
if (!methodNames) {
methodNames = baseFunctions(source, keys(source));
}
var chain = true,
index = -1,
isFunc = isFunction(object),
length = methodNames.length;
if (options === false) {
chain = false;
} else if (isObject(options) && 'chain' in options) {
chain = options.chain;
}
var index = -1,
isFunc = isFunction(object),
length = methodNames.length;
while (++index < length) {
var methodName = methodNames[index];
object[methodName] = source[methodName];