Comparing version 2.19.1 to 2.19.2
@@ -6,3 +6,3 @@ import { HLTVConfig } from '../config'; | ||
size?: EventSize | undefined; | ||
month?: Number | undefined; | ||
month?: 0 | 1 | 2 | 4 | 3 | 10 | 9 | 8 | 7 | 6 | 5 | 11 | undefined; | ||
}) => Promise<EventResult[]>; |
@@ -42,2 +42,3 @@ "use strict"; | ||
var EventType_1 = require("../enums/EventType"); | ||
var parsing_1 = require("../utils/parsing"); | ||
exports.getEvents = function (config) { return function (_a) { | ||
@@ -70,3 +71,3 @@ var _b = _a === void 0 ? {} : _a, size = _b.size, month = _b.month; | ||
month: checkMonth, | ||
events: parseEvents(mappers_1.toArray(eventEl.find('a.big-event'))).concat(parseEvents(mappers_1.toArray(eventEl.find('a.small-event')))) | ||
events: parseEvents(mappers_1.toArray(eventEl.find('a.big-event')), EventSize_1.EventSize.Big).concat(parseEvents(mappers_1.toArray(eventEl.find('a.small-event')), EventSize_1.EventSize.Small)) | ||
}; | ||
@@ -84,3 +85,3 @@ } | ||
var parseEvents = function (eventsToParse, size) { | ||
var dateSelector, nameSelector, locationSelector = ''; | ||
var dateSelector, nameSelector, locationSelector; | ||
if (size == EventSize_1.EventSize.Small) { | ||
@@ -97,2 +98,3 @@ dateSelector = '.eventDetails .col-desc span[data-unix]'; | ||
var events = eventsToParse.map(function (eventEl) { | ||
var _a; | ||
var dateStart = eventEl | ||
@@ -106,4 +108,4 @@ .find(dateSelector) | ||
.data('unix'); | ||
var teams = '0'; | ||
var prizePool = ''; | ||
var teams; | ||
var prizePool; | ||
if (size == EventSize_1.EventSize.Small) { | ||
@@ -131,3 +133,3 @@ teams = eventEl | ||
var eventName = eventEl.find(nameSelector).text(); | ||
var typeName = eventEl | ||
var rawType = eventEl | ||
.find('table tr') | ||
@@ -137,5 +139,13 @@ .eq(0) | ||
.eq(3) | ||
.text(); | ||
if (!typeName) | ||
typeName = eventName.toLowerCase().includes('major') ? EventType_1.EventType.Major : undefined; | ||
.text() || undefined; | ||
var eventType = (_a = Object.entries({ | ||
major: EventType_1.EventType.Major, | ||
online: EventType_1.EventType.Online, | ||
intl: EventType_1.EventType.InternationalLan, | ||
local: EventType_1.EventType.LocalLan, | ||
reg: EventType_1.EventType.RegionalLan | ||
}).find(function (_a) { | ||
var needle = _a[0]; | ||
return (rawType ? rawType.toLowerCase().includes(needle) : false); | ||
})) === null || _a === void 0 ? void 0 : _a[1]; | ||
return { | ||
@@ -148,4 +158,7 @@ id: Number(eventEl.attr('href').split('/')[2]), | ||
teams: teams.length ? Number(teams) : undefined, | ||
location: eventEl.find(locationSelector).prop('title'), | ||
type: typeName ? typeName : undefined | ||
location: { | ||
name: eventEl.find(locationSelector).prop('title'), | ||
code: parsing_1.popSlashSource(eventEl.find(locationSelector)).split('.')[0] | ||
}, | ||
type: eventType || EventType_1.EventType.Other | ||
}; | ||
@@ -152,0 +165,0 @@ }); |
export declare enum EventType { | ||
Online = "Online", | ||
LocalLan = "Local LAN", | ||
IntlLan = "International LAN", | ||
RegLan = "Regional LAN", | ||
Major = "Major", | ||
Other = "Other" | ||
Online = "ONLINE", | ||
LocalLan = "LOCALLAN", | ||
InternationalLan = "INTLLAN", | ||
RegionalLan = "REGIONALLAN", | ||
Major = "MAJOR", | ||
Other = "OTHER" | ||
} |
@@ -5,8 +5,8 @@ "use strict"; | ||
(function (EventType) { | ||
EventType["Online"] = "Online"; | ||
EventType["LocalLan"] = "Local LAN"; | ||
EventType["IntlLan"] = "International LAN"; | ||
EventType["RegLan"] = "Regional LAN"; | ||
EventType["Major"] = "Major"; | ||
EventType["Other"] = "Other"; | ||
EventType["Online"] = "ONLINE"; | ||
EventType["LocalLan"] = "LOCALLAN"; | ||
EventType["InternationalLan"] = "INTLLAN"; | ||
EventType["RegionalLan"] = "REGIONALLAN"; | ||
EventType["Major"] = "MAJOR"; | ||
EventType["Other"] = "OTHER"; | ||
})(EventType = exports.EventType || (exports.EventType = {})); |
@@ -69,3 +69,3 @@ import { HLTVConfig } from './config'; | ||
size?: EventSize | undefined; | ||
month?: Number | undefined; | ||
month?: 0 | 1 | 2 | 4 | 3 | 10 | 9 | 8 | 7 | 6 | 5 | 11 | undefined; | ||
}) => Promise<import("./models/EventResult").EventResult[]>; | ||
@@ -72,0 +72,0 @@ getPlayerStats: ({ id, startDate, endDate, matchType, rankingFilter }: { |
@@ -11,3 +11,3 @@ import { Country } from './Country'; | ||
location: Country; | ||
type?: EventType; | ||
type: EventType; | ||
} |
{ | ||
"name": "hltv", | ||
"version": "2.19.1", | ||
"version": "2.19.2", | ||
"description": "The unofficial HLTV Node.js API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198710
3812