diff --git a/lodash.compat.js b/lodash.compat.js index 1ae6c5e01..a87b713ee 100644 --- a/lodash.compat.js +++ b/lodash.compat.js @@ -1789,7 +1789,7 @@ } // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' - ? baseMatches(func, argCount) + ? baseMatches(func, !argCount) : baseProperty(argCount ? (func + '') : func); } @@ -2416,7 +2416,7 @@ /** * The base implementation of `_.matches` which supports specifying whether - * `source` is cloned. + * `source` should be cloned. * * @private * @param {Object} source The object of property values to match. @@ -2437,16 +2437,16 @@ }; } } - var notCloned = !isCloned, - values = Array(length), + if (isCloned) { + source = baseClone(source, true); + } + var values = Array(length), strictCompareFlags = Array(length); while (length--) { value = source[props[length]]; - var isStrict = isStrictComparable(value); - - values[length] = (isStrict || notCloned) ? value : baseClone(value, true, clonePassthru); - strictCompareFlags[length] = isStrict; + values[length] = value; + strictCompareFlags[length] = isStrictComparable(value); } return function(object) { 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, * placeholders, and provided arguments into a single array of arguments. @@ -3718,17 +3706,6 @@ 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. *