Skip to content

Commit

Permalink
Make removeEdge chainable
Browse files Browse the repository at this point in the history
  • Loading branch information
cpettitt committed Sep 24, 2014
1 parent 3e1d0ce commit 5405c82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ Graph.prototype.removeEdge = function(v, w, name) {
delete this._out[v][e];
this._edgeCount--;
}
return this;
};

function decrementOrRemoveEntry(map, k) {
Expand Down
5 changes: 5 additions & 0 deletions test/graph-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,11 @@ describe("Graph", function() {
expect(g.predecessors("b")).to.eql(["a"]);
expect(g.neighbors("b")).to.eql(["a"]);
});

it("is chainable", function() {
g.setEdge("a", "b");
expect(g.removeEdge("a", "b")).to.equal(g);
});
});

describe("inEdges", function() {
Expand Down

0 comments on commit 5405c82

Please sign in to comment.