match.js 776 B

123456789101112131415161718192021222324
  1. import { normalize } from '../helpers.js'
  2. /** Class representing a match */
  3. class Match {
  4. /**
  5. * Create a match
  6. * A match data item in the Swisstennis Calendar.xlsx file has the following columns
  7. * Ort | Datum | Zeit | Konkurrenz | Spieler 1 | Spieler 1 Klassierung | Spieler 2 |
  8. * Spieler 2 Klassierung | [Resultat]
  9. */
  10. constructor (data) {
  11. this.Ort = normalize(data[0])
  12. this.Datum = data[1]
  13. this.Konkurrenz = normalize(data[3])
  14. this.Spieler1 = normalize(data[4])
  15. this.Spieler1Klassierung = normalize(data[5])
  16. this.Spieler2 = normalize(data[6])
  17. this.Spieler2Klassierung = normalize(data[7])
  18. this.Resultat = normalize(data[8] || null)
  19. this.isDoubles = this.Konkurrenz.match(/DM.*|[MW]D.*/)
  20. }
  21. }
  22. export default { Match }