@sarahisweird/hmoog
Version:
Out-of-game automation for Hackmud
24 lines (23 loc) • 604 B
JavaScript
export var NodeType;
(function (NodeType) {
NodeType[NodeType["TEXT"] = 0] = "TEXT";
NodeType[NodeType["COLOR"] = 1] = "COLOR";
NodeType[NodeType["END_TAG"] = 2] = "END_TAG";
})(NodeType || (NodeType = {}));
export class NodeVisitor {
visitAll(nodes) {
for (const node of nodes) {
this.visit(node);
}
}
visit(node) {
switch (node.type) {
case NodeType.TEXT:
this.visitText(node);
break;
case NodeType.COLOR:
this.visitColor(node);
break;
}
}
}