UNPKG

@mome0320/kartrider.js-fetch

Version:

KartRider library interacting with Nexon API use fetch

35 lines (34 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Match { constructor(data, kartMetaData) { this.matchType = kartMetaData ? kartMetaData.getMetaData({ type: 'gameType', hash: data.matchType }) : { id: data.matchType }; this.channelName = data.channelName; this.track = kartMetaData ? kartMetaData.getMetaData({ type: 'track', hash: data.trackId }) : { id: data.trackId }; this.matchResult = data.matchResult; this.startTime = new Date(data.startTime + "Z"); this.endTime = new Date(data.endTime + "Z"); this.id = data.matchId; } get gameSpeed() { if (this.channelName.includes("Infinit")) return "무한"; else if (this.channelName.includes("Fastest2Enchant")) return "가장빠름"; else if (this.channelName.includes("Fastest")) return "매우빠름"; else if (this.channelName.includes("Fast")) return "빠름"; return "보통"; } get isTeam() { return this.channelName.includes('Team'); } get isSpecialMode() { return this.channelName.includes('_'); } get playTime() { return (this.endTime.getTime() - this.startTime.getTime()); } } exports.default = Match;