Fix _.isEquals() for wrapped objects

This caught me out when writing some unit tests that use _.isEquals().
They were all passing even though I knew they shouldn't be, and I
realised I was checking equality with a wrapped object that I'd
forgotten to unwrap.
This commit is contained in:
Jason Davies
2010-12-03 13:01:58 +00:00
parent c714175cf1
commit 2120b27b22
2 changed files with 8 additions and 3 deletions

View File

@@ -519,6 +519,9 @@
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
// Unwrap any wrapped objects
if (a && a._chain) a = a.value();
if (b && b._chain) b = b.value();
// Check object identity.
if (a === b) return true;
// Different types?