Skip to content

Commit f75e49a

Browse files
committed
Different objects aren't the same
This may have been what was originally intended.
1 parent c866adf commit f75e49a

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

lib/eql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function objectEqual(a, b, m) {
213213
return false;
214214
}
215215

216-
if (a.prototype !== b.prototype) {
216+
if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) {
217217
return false;
218218
}
219219

test/eql.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ tests.push([ 'eql([], [])', [], [] ]);
2121
tests.push([ 'eql({}, {})', {}, {} ]);
2222
tests.push([ 'eql([], {})', [], {}, true ]);
2323

24+
/*!
25+
* object identity
26+
*/
27+
28+
function Base1() {};
29+
function Base2() {};
30+
var object1 = new Base1();
31+
var object2 = new Base2();
32+
33+
tests.push([ 'eql(object1, object1)', object1, object1 ]);
34+
tests.push([ 'eql(object1, object2)', object1, object2, true ]);
35+
2436
(function() {
2537
tests.push([ 'eql([], arguments)', [], arguments, true ]);
2638
})();

0 commit comments

Comments
 (0)