import components from './components' function normalize (item, type) { return item ? String(item).replace(/\s+/g, ' ').trim() : null } /** Class representing a player */ class MatchClass { /** * Create a player * A player data item in the Swisstennis PlayerList.xlsx file has the following columns * Ort | Datum | Zeit | Konkurrenz | Spieler 1 | Spieler 1 Klassierung | Spieler 2 | Spieler 2 Klassierung */ constructor (data) { this.Ort = normalize(data[0]) this.Datum = data[1] this.Konkurrenz = normalize(data[3]) this.Spieler1 = normalize(data[4]) this.Spieler1Klassierung = normalize(data[5]) this.Spieler2 = normalize(data[6]) this.Spieler2Klassierung = normalize(data[7]) this.Resultat = data[8] ? normalize(data[8]) : null } isDoubles () { return this.Konkurrenz.match(/DM.*|[MW]D.*/) } } const state = { matches: [], filtered: [], places: [], dates: [], categories: [], filters: {} } export default { MatchClass, components, state }