Updated to springy 2.0.1

This commit is contained in:
Dennis Hotson 2013-03-15 11:25:23 +00:00
parent 7d1bc9ec5c
commit 22c2b877fb

View File

@ -1,5 +1,5 @@
/** /**
* Springy v2.0.0 * Springy v2.0.1
* *
* Copyright (c) 2010 Dennis Hotson * Copyright (c) 2010 Dennis Hotson
* *
@ -215,7 +215,6 @@
} }
this.detachNode(node); this.detachNode(node);
}; };
// removes edges associated with a given node // removes edges associated with a given node
@ -247,6 +246,16 @@
this.adjacency[x][y].splice(j, 1); this.adjacency[x][y].splice(j, 1);
} }
} }
// Clean up empty edge arrays
if (this.adjacency[x][y].length == 0) {
delete this.adjacency[x][y];
}
}
// Clean up empty objects
if (isEmpty(this.adjacency[x])) {
delete this.adjacency[x];
} }
} }
@ -676,4 +685,13 @@
} }
}; };
} }
var isEmpty = function(obj) {
for (var k in obj) {
if (obj.hasOwnProperty(k)) {
return false;
}
}
return true;
};
}).call(this); }).call(this);