Skip to content

Commit

Permalink
Prep v2.1.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
cpettitt committed Dec 31, 2017
1 parent c36b9fa commit bd166fe
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 52 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphlib",
"version": "2.1.4",
"version": "2.1.5",
"main": [
"dist/graphlib.core.js"
],
Expand Down
45 changes: 24 additions & 21 deletions dist/graphlib.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,26 +702,29 @@ Graph.prototype.nodes = function() {
};

Graph.prototype.sources = function() {
return _.filter(this.nodes(), _.bind(function(v) {
return _.isEmpty(this._in[v]);
}, this));
var self = this;
return _.filter(this.nodes(), function(v) {
return _.isEmpty(self._in[v]);
});
};

Graph.prototype.sinks = function() {
return _.filter(this.nodes(), _.bind(function(v) {
return _.isEmpty(this._out[v]);
}, this));
var self = this;
return _.filter(this.nodes(), function(v) {
return _.isEmpty(self._out[v]);
});
};

Graph.prototype.setNodes = function(vs, value) {
var args = arguments;
_.each(vs, _.bind(function(v) {
var self = this;
_.each(vs, function(v) {
if (args.length > 1) {
this.setNode(v, value);
self.setNode(v, value);
} else {
this.setNode(v);
self.setNode(v);
}
}, this));
});
return this;
};

Expand Down Expand Up @@ -763,9 +766,9 @@ Graph.prototype.removeNode = function(v) {
if (this._isCompound) {
this._removeFromParentsChildList(v);
delete this._parent[v];
_.each(this.children(v), _.bind(function(child) {
this.setParent(child);
}, this));
_.each(this.children(v), function(child) {
self.setParent(child);
});
delete this._children[v];
}
_.each(_.keys(this._in[v]), removeEdge);
Expand Down Expand Up @@ -794,7 +797,7 @@ Graph.prototype.setParent = function(v, parent) {
ancestor = this.parent(ancestor)) {
if (ancestor === v) {
throw new Error("Setting " + parent+ " as parent of " + v +
" would create create a cycle");
" would create a cycle");
}
}

Expand Down Expand Up @@ -878,19 +881,19 @@ Graph.prototype.filterNodes = function(filter) {

copy.setGraph(this.graph());

_.each(this._nodes, _.bind(function(value, v) {
var self = this;
_.each(this._nodes, function(value, v) {
if (filter(v)) {
copy.setNode(v, value);
}
}, this));
});

_.each(this._edgeObjs, _.bind(function(e) {
_.each(this._edgeObjs, function(e) {
if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
copy.setEdge(e, this.edge(e));
copy.setEdge(e, self.edge(e));
}
}, this));
});

var self = this;
var parents = {};
function findParent(v) {
var parent = self.parent(v);
Expand Down Expand Up @@ -1210,7 +1213,7 @@ if (!lodash) {
module.exports = lodash;

},{"lodash":undefined}],20:[function(require,module,exports){
module.exports = '2.1.4';
module.exports = '2.1.5';

},{}]},{},[1])(1)
});
6 changes: 3 additions & 3 deletions dist/graphlib.core.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 24 additions & 21 deletions dist/graphlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,26 +702,29 @@ Graph.prototype.nodes = function() {
};

Graph.prototype.sources = function() {
return _.filter(this.nodes(), _.bind(function(v) {
return _.isEmpty(this._in[v]);
}, this));
var self = this;
return _.filter(this.nodes(), function(v) {
return _.isEmpty(self._in[v]);
});
};

Graph.prototype.sinks = function() {
return _.filter(this.nodes(), _.bind(function(v) {
return _.isEmpty(this._out[v]);
}, this));
var self = this;
return _.filter(this.nodes(), function(v) {
return _.isEmpty(self._out[v]);
});
};

Graph.prototype.setNodes = function(vs, value) {
var args = arguments;
_.each(vs, _.bind(function(v) {
var self = this;
_.each(vs, function(v) {
if (args.length > 1) {
this.setNode(v, value);
self.setNode(v, value);
} else {
this.setNode(v);
self.setNode(v);
}
}, this));
});
return this;
};

Expand Down Expand Up @@ -763,9 +766,9 @@ Graph.prototype.removeNode = function(v) {
if (this._isCompound) {
this._removeFromParentsChildList(v);
delete this._parent[v];
_.each(this.children(v), _.bind(function(child) {
this.setParent(child);
}, this));
_.each(this.children(v), function(child) {
self.setParent(child);
});
delete this._children[v];
}
_.each(_.keys(this._in[v]), removeEdge);
Expand Down Expand Up @@ -794,7 +797,7 @@ Graph.prototype.setParent = function(v, parent) {
ancestor = this.parent(ancestor)) {
if (ancestor === v) {
throw new Error("Setting " + parent+ " as parent of " + v +
" would create create a cycle");
" would create a cycle");
}
}

Expand Down Expand Up @@ -878,19 +881,19 @@ Graph.prototype.filterNodes = function(filter) {

copy.setGraph(this.graph());

_.each(this._nodes, _.bind(function(value, v) {
var self = this;
_.each(this._nodes, function(value, v) {
if (filter(v)) {
copy.setNode(v, value);
}
}, this));
});

_.each(this._edgeObjs, _.bind(function(e) {
_.each(this._edgeObjs, function(e) {
if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
copy.setEdge(e, this.edge(e));
copy.setEdge(e, self.edge(e));
}
}, this));
});

var self = this;
var parents = {};
function findParent(v) {
var parent = self.parent(v);
Expand Down Expand Up @@ -1210,7 +1213,7 @@ if (!lodash) {
module.exports = lodash;

},{"lodash":21}],20:[function(require,module,exports){
module.exports = '2.1.4';
module.exports = '2.1.5';

},{}],21:[function(require,module,exports){
(function (global){
Expand Down
Loading

0 comments on commit bd166fe

Please sign in to comment.