Skip to content

Commit

Permalink
Remove special code to check obj equality.
Browse files Browse the repository at this point in the history
* Now just use JS equality.
  • Loading branch information
maryrosecook committed Aug 3, 2013
1 parent e60c5fb commit 8624c14
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/library.js
Expand Up @@ -76,21 +76,6 @@
}
};

var sameRef = function(a, b) {
if (a === undefined || b === undefined) return false;
if (a.ref === undefined || b.ref === undefined) return false;
if (a.ref.length !== b.ref.length) return false;
return _.every(_.zip(a.ref, b.ref), function(x) {
return x[0] === x[1];
});
};

var objsEqual = function(a, b) {
// can't check for dupes where one resolved and other ref - haven't got env
return sameRef(a, b) ||
a === b; // same resolved obj
}

var List = function() {
var data = [];

Expand All @@ -102,7 +87,7 @@
// note: will always be refs unless part of list that is being resolved
.when("Object", function(thing) {
for(var i = 0; i < data.length; i++) {
if (objsEqual(thing, data[i])) {
if (thing === data[i]) {
return;
}
}
Expand All @@ -123,7 +108,7 @@
.when("Object", function(thing) {
// can't reject dupes where one resolved other ref - haven't got env
for(var i = 0; i < data.length; i++) {
if (objsEqual(thing, data[i])) {
if (thing === data[i]) {
data.splice(i, 1);
break;
}
Expand Down

0 comments on commit 8624c14

Please sign in to comment.