Issue #329, special check for the common and magical 'length' property.

This commit is contained in:
Jeremy Ashkenas
2011-10-18 23:26:59 -04:00
parent 86eedd2a7b
commit 7fc616943e
2 changed files with 3 additions and 1 deletions

View File

@@ -675,6 +675,8 @@
}
// Ensure that both values are objects.
if (typeA != 'object') return false;
// Arrays or Arraylikes with different lengths are not equal.
if (a.length !== b.length) return false;
// Objects with different constructors are not equal.
if (a.constructor !== b.constructor) return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic structures is