mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Issue #329, special check for the common and magical 'length' property.
This commit is contained in:
@@ -183,7 +183,7 @@ $(document).ready(function() {
|
||||
|
||||
// Sparse arrays.
|
||||
ok(_.isEqual(Array(3), Array(3)), "Sparse arrays of identical lengths are equal");
|
||||
ok(_.isEqual(Array(3), Array(6)), "Sparse arrays of different lengths are equal when both are empty");
|
||||
ok(!_.isEqual(Array(3), Array(6)), "Sparse arrays of different lengths are not equal when both are empty");
|
||||
|
||||
// According to the Microsoft deviations spec, section 2.1.26, JScript 5.x treats `undefined`
|
||||
// elements in arrays as elisions. Thus, sparse arrays and dense arrays containing `undefined`
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user