UNPKG

formula1.js

Version:
23 lines (22 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DriverStandings = void 0; const Request_1 = require("../Request"); const DriverStanding_1 = require("./DriverStanding"); const Standings_1 = require("./Standings"); class DriverStandings extends Standings_1.Standings { pop = async () => { const defaultLimit = 150; const round = `${this.round != null && this.round > 0 ? `/${Math.floor(this.round)}` : ''}`; const data = (await (0, Request_1.Request)(`${this.year}${round}/driverStandings`, `limit=${this.limit || defaultLimit}`)); const standings = data.MRData.StandingsTable.StandingsLists[0]; this.season = parseInt(standings.season); this.completedRounds = parseInt(standings.round); this.standings = standings.DriverStandings.map(s => new DriverStanding_1.DriverStanding(this, s)); this.initialized = true; return this; }; } exports.DriverStandings = DriverStandings;