wcif-helpers
Version:
Some helpers for WCIF
28 lines • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLimitByRoundId = exports.getCutoffByRoundId = exports.getEventIdFromRoundId = exports.getRoundInfoFromWcif = exports.getEventInfoFromWcif = void 0;
var getEventInfoFromWcif = function (eventId, wcif) {
return wcif.events.find(function (event) { return event.id === eventId; });
};
exports.getEventInfoFromWcif = getEventInfoFromWcif;
var getRoundInfoFromWcif = function (roundId, wcif) {
var eventId = (0, exports.getEventIdFromRoundId)(roundId);
var event = (0, exports.getEventInfoFromWcif)(eventId, wcif);
return event === null || event === void 0 ? void 0 : event.rounds.find(function (round) { return round.id === roundId; });
};
exports.getRoundInfoFromWcif = getRoundInfoFromWcif;
var getEventIdFromRoundId = function (roundId) {
return roundId.split("-")[0];
};
exports.getEventIdFromRoundId = getEventIdFromRoundId;
var getCutoffByRoundId = function (roundId, wcif) {
var round = (0, exports.getRoundInfoFromWcif)(roundId, wcif);
return (round === null || round === void 0 ? void 0 : round.cutoff) || null;
};
exports.getCutoffByRoundId = getCutoffByRoundId;
var getLimitByRoundId = function (roundId, wcif) {
var round = (0, exports.getRoundInfoFromWcif)(roundId, wcif);
return (round === null || round === void 0 ? void 0 : round.timeLimit) || null;
};
exports.getLimitByRoundId = getLimitByRoundId;
//# sourceMappingURL=events.js.map