beth-parser
Version:
Parser library for Bethesda's Creation Engine data files
28 lines • 985 B
JavaScript
;
exports.__esModule = true;
var ModfileDefs_1 = require("../ModfileDefs");
var utils_1 = require("../../utils");
/**
* Group (container) entry.
*/
var GroupEntry = /** @class */ (function () {
function GroupEntry(type, label, children) {
if (children === void 0) { children = []; }
this.type = type;
this.label = label;
this.children = children;
}
/**
* Convert to a more user-friendly format.
*/
GroupEntry.prototype.toJSON = function () {
return this.type === ModfileDefs_1.GroupType.ROOT ? this.children : {
type: ModfileDefs_1.GroupType[this.type] || this.type,
label: this.type === ModfileDefs_1.GroupType.TOP ? utils_1.decodeTypeTag(this.label) : this.type,
children: this.children.length ? this.children : undefined
};
};
return GroupEntry;
}());
exports["default"] = GroupEntry;
//# sourceMappingURL=GroupEntry.js.map