UNPKG

formula1.js

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