Skip to content

Commit

Permalink
Trying the parent/child disqualification again.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 26, 2014
1 parent a0d3efd commit 34aa425
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module.exports = function isEqual(value, other) {
}

if (type === objType) {
if (value.isPrototypeOf(other) || other.isPrototypeOf(value)) { return false; }
if (getPrototypeOf(value) !== getPrototypeOf(other)) { return false; }
var key;
for (key in value) {
Expand Down
4 changes: 3 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ test('objects', function (t) {
st.notOk(isEqual(f1, i1), 'two instances of different things with a different prototype are not equal');

var isParentEqualToChild = isEqual(f1, g1);
// st.notOk(isParentEqualToChild, 'two instances of a parent and child are not equal');
st.notOk(isParentEqualToChild, 'two instances of a parent and child are not equal');
var isChildEqualToParent = isEqual(g1, f1);
st.notOk(isChildEqualToParent, 'two instances of a child and parent are not equal');

g1.foo = 'bar';
var g2 = new G();
Expand Down

0 comments on commit 34aa425

Please sign in to comment.