mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Cleanup _.mixin.
This commit is contained in:
31
lodash.js
31
lodash.js
@@ -10146,30 +10146,31 @@
|
|||||||
* // => ['e']
|
* // => ['e']
|
||||||
*/
|
*/
|
||||||
function mixin(object, source, options) {
|
function mixin(object, source, options) {
|
||||||
var chain = true,
|
if (options == null) {
|
||||||
isObj = isObject(source),
|
var isObj = isObject(source),
|
||||||
noOpts = options == null,
|
props = isObj && keys(source),
|
||||||
props = noOpts && isObj && keys(source),
|
methodNames = props && props.length && baseFunctions(source, props);
|
||||||
methodNames = props && baseFunctions(source, props);
|
|
||||||
|
|
||||||
if ((props && props.length && !methodNames.length) || (noOpts && !isObj)) {
|
if (!(methodNames ? methodNames.length : isObj)) {
|
||||||
if (noOpts) {
|
methodNames = false;
|
||||||
options = source;
|
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) {
|
if (options === false) {
|
||||||
chain = false;
|
chain = false;
|
||||||
} else if (isObject(options) && 'chain' in options) {
|
} else if (isObject(options) && 'chain' in options) {
|
||||||
chain = options.chain;
|
chain = options.chain;
|
||||||
}
|
}
|
||||||
var index = -1,
|
|
||||||
isFunc = isFunction(object),
|
|
||||||
length = methodNames.length;
|
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var methodName = methodNames[index];
|
var methodName = methodNames[index];
|
||||||
object[methodName] = source[methodName];
|
object[methodName] = source[methodName];
|
||||||
|
|||||||
Reference in New Issue
Block a user