Cleanup _.matches.

This commit is contained in:
John-David Dalton
2014-10-16 22:52:37 -07:00
parent 28c4ad1501
commit eed09f64f7

View File

@@ -9238,15 +9238,15 @@
} }
} }
var index = length, var index = length,
flags = Array(length), values = Array(length),
vals = Array(length); strictCompareFlags = Array(length);
while (index--) { while (index--) {
value = source[props[index]]; value = source[props[index]];
var isStrict = isStrictComparable(value); var isStrict = isStrictComparable(value);
flags[index] = isStrict; values[index] = isStrict ? value : baseClone(value, true, matchesCloneCallback);
vals[index] = isStrict ? value : baseClone(value); strictCompareFlags[index] = isStrict;
} }
return function(object) { return function(object) {
index = length; index = length;
@@ -9254,13 +9254,19 @@
return !index; return !index;
} }
while (index--) { while (index--) {
if (flags[index] ? vals[index] !== object[props[index]] : !hasOwnProperty.call(object, props[index])) { if (strictCompareFlags[index]
? values[index] !== object[props[index]]
: !hasOwnProperty.call(object, props[index])
) {
return false; return false;
} }
} }
index = length; index = length;
while (index--) { while (index--) {
if (flags[index] ? !hasOwnProperty.call(object, props[index]) : !baseIsEqual(vals[index], object[props[index]], null, true)) { if (strictCompareFlags[index]
? !hasOwnProperty.call(object, props[index])
: !baseIsEqual(values[index], object[props[index]], null, true)
) {
return false; return false;
} }
} }