@tucmc/hazel
Version:
Clubs Data Processing Framework
37 lines (36 loc) • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IDUtil = void 0;
const ID_1 = require("./ID");
class IDUtil extends ID_1.ID {
static applyOverriddenLayer(id) {
const layer = this.overriddenTranslationLayer.reverse();
if (layer.hasKey(id)) {
const translated = layer.get(id);
if (!translated)
throw Error(`unable to translate ${id}`);
return translated;
}
return id;
}
static applyClubSectionFilter(id) {
const layer = this.clubsSectionTranslationLayer;
if (layer.hasKey(id)) {
const translated = layer.get(id);
if (!translated)
throw Error(`unable to translate ${id}`);
return translated;
}
return id;
}
static translateToClubName(id, includeSection = true) {
if (includeSection) {
return this.systemClubs.get(id) || '';
}
return this.clubsNoSection.get(id) || '';
}
static translateToMainClubName(id) {
return this.mainClubs.get(id) || '';
}
}
exports.IDUtil = IDUtil;