Skip to content

Commit

Permalink
circular test for topological circular equality passes
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Jun 3, 2011
1 parent 7fa7247 commit b423996
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ function Traverse (obj) {
Traverse.prototype.get = function (ps) {
var node = this.value;
for (var i = 0; i < ps.length; i ++) {
var key = ps[i];
if (!Object.hasOwnProperty.call(node, key)) {
node = undefined;
break;
}
node = node[ps[i]];
node = node[key];
}
return node;
};
Expand Down Expand Up @@ -68,7 +69,10 @@ Traverse.prototype.deepEqual = function (obj) {
return Object.prototype.toString.call(o);
};

if (typeof x !== typeof y) {
if (this.circular) {
if (Traverse(obj).get(this.circular.path) !== x) notEqual();
}
else if (typeof x !== typeof y) {
notEqual();
}
else if (x.__proto__ !== y.__proto__) {
Expand Down

0 comments on commit b423996

Please sign in to comment.