Remove clonePassthru.

This commit is contained in:
John-David Dalton
2015-01-09 13:54:02 -08:00
parent 68fc036b7a
commit 8d4d2d62c1

View File

@@ -1789,7 +1789,7 @@
} }
// Handle "_.property" and "_.matches" style callback shorthands. // Handle "_.property" and "_.matches" style callback shorthands.
return type == 'object' return type == 'object'
? baseMatches(func, argCount) ? baseMatches(func, !argCount)
: baseProperty(argCount ? (func + '') : func); : baseProperty(argCount ? (func + '') : func);
} }
@@ -2416,7 +2416,7 @@
/** /**
* The base implementation of `_.matches` which supports specifying whether * The base implementation of `_.matches` which supports specifying whether
* `source` is cloned. * `source` should be cloned.
* *
* @private * @private
* @param {Object} source The object of property values to match. * @param {Object} source The object of property values to match.
@@ -2437,16 +2437,16 @@
}; };
} }
} }
var notCloned = !isCloned, if (isCloned) {
values = Array(length), source = baseClone(source, true);
}
var values = Array(length),
strictCompareFlags = Array(length); strictCompareFlags = Array(length);
while (length--) { while (length--) {
value = source[props[length]]; value = source[props[length]];
var isStrict = isStrictComparable(value); values[length] = value;
strictCompareFlags[length] = isStrictComparable(value);
values[length] = (isStrict || notCloned) ? value : baseClone(value, true, clonePassthru);
strictCompareFlags[length] = isStrict;
} }
return function(object) { return function(object) {
return baseIsMatch(object, props, values, strictCompareFlags); return baseIsMatch(object, props, values, strictCompareFlags);
@@ -2898,18 +2898,6 @@
}; };
} }
/**
* Used by `_.matches` to clone `source` values, letting uncloneable values
* passthu instead of returning empty objects.
*
* @private
* @param {*} value The value to clone.
* @returns {*} Returns the cloned value.
*/
function clonePassthru(value) {
return isCloneable(value) ? undefined : value;
}
/** /**
* Creates an array that is the composition of partially applied arguments, * Creates an array that is the composition of partially applied arguments,
* placeholders, and provided arguments into a single array of arguments. * placeholders, and provided arguments into a single array of arguments.
@@ -3718,17 +3706,6 @@
return result; return result;
} }
/**
* Checks if `value` is cloneable.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is cloneable, else `false`.
*/
function isCloneable(value) {
return (value && cloneableTags[objToString.call(value)] && !isHostObject(value)) || false;
}
/** /**
* Checks if the provided arguments are from an iteratee call. * Checks if the provided arguments are from an iteratee call.
* *