ccatjs
Version:
Concatenate files using in-file @import: statements.
37 lines (28 loc) • 837 B
JavaScript
module.exports = {
entry: class
{
constructor(name) {
this.name = name;
this.parent = null;
this.children = [];
}
addChild(name) {
var e = new module.exports.entry(name);
e.parent = this;
this.children.push(e);
return e;
}
isCircular(name) {
if (name == this.name) return true;
var originalParent = this.parent;
var that = this;
var circular = false;
while (that.parent != null) {
if (that.parent.name == name) circular = true;
that.parent = that.parent.parent;
}
that.parent = originalParent;
return circular;
}
}
}