chat-bet-parse
Version:
TypeScript package for parsing sports betting contract text into structured data types compatible with SQL Server stored procedures
121 lines (118 loc) • 3.95 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/types-only.ts
var types_only_exports = {};
__export(types_only_exports, {
isFill: () => isFill,
isHandicapLine: () => isHandicapLine,
isHandicapML: () => isHandicapML,
isOrder: () => isOrder,
isParlay: () => isParlay,
isPropOU: () => isPropOU,
isPropYN: () => isPropYN,
isRoundRobin: () => isRoundRobin,
isSeries: () => isSeries,
isStraight: () => isStraight,
isTotalPoints: () => isTotalPoints,
isTotalPointsContestant: () => isTotalPointsContestant,
isWritein: () => isWritein,
knownLeagues: () => knownLeagues,
knownSports: () => knownSports,
leagueSportMap: () => leagueSportMap
});
module.exports = __toCommonJS(types_only_exports);
// src/types/index.ts
var leagueSportMap = {
MLB: "Baseball",
WNBA: "Basketball",
CBK: "Basketball",
CBB: "Basketball",
NBA: "Basketball",
CFL: "Football",
CFB: "Football",
NFL: "Football",
UFL: "Football",
FCS: "Football",
LPGA: "Golf",
PGA: "Golf",
NHL: "Hockey",
UFC: "MMA",
WTA: "Tennis",
ATP: "Tennis"
};
var knownLeagues = new Set(Object.keys(leagueSportMap));
var knownSports = new Set(Object.values(leagueSportMap));
function isOrder(result) {
return result.chatType === "order";
}
function isFill(result) {
return result.chatType === "fill";
}
function isStraight(result) {
return result.betType === "straight";
}
function isParlay(result) {
return result.betType === "parlay";
}
function isRoundRobin(result) {
return result.betType === "roundRobin";
}
function isTotalPoints(contract) {
return "ContractSportCompetitionMatchType" in contract && contract.ContractSportCompetitionMatchType === "TotalPoints" && !contract.HasContestant;
}
function isTotalPointsContestant(contract) {
return "ContractSportCompetitionMatchType" in contract && contract.ContractSportCompetitionMatchType === "TotalPoints" && contract.HasContestant;
}
function isHandicapML(contract) {
return "ContractSportCompetitionMatchType" in contract && contract.ContractSportCompetitionMatchType === "Handicap" && contract.HasContestant && !contract.HasLine;
}
function isHandicapLine(contract) {
return "ContractSportCompetitionMatchType" in contract && contract.ContractSportCompetitionMatchType === "Handicap" && contract.HasContestant && contract.HasLine;
}
function isPropOU(contract) {
return "ContractSportCompetitionMatchType" in contract && contract.ContractSportCompetitionMatchType === "Prop" && contract.HasContestant && contract.HasLine;
}
function isPropYN(contract) {
return "ContractSportCompetitionMatchType" in contract && contract.ContractSportCompetitionMatchType === "Prop" && contract.HasContestant && !contract.HasLine;
}
function isSeries(contract) {
return "SeriesLength" in contract;
}
function isWritein(contract) {
return "EventDate" in contract && "Description" in contract;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
isFill,
isHandicapLine,
isHandicapML,
isOrder,
isParlay,
isPropOU,
isPropYN,
isRoundRobin,
isSeries,
isStraight,
isTotalPoints,
isTotalPointsContestant,
isWritein,
knownLeagues,
knownSports,
leagueSportMap
});