-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (26 loc) · 818 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const dateFormat = require('dateformat')
const paramCase = require('param-case')
let defaults = {
datumVon: dateFormat(new Date(), 'yyyy-mm-dd'),
datumBis: dateFormat(new Date(2018, 05, 30), 'yyyy-mm-dd'),
max: 20,
matchType: -1,
wettkampftyp: -1,
showVenues: true,
mimeType: 'HTML',
baseUrl: 'http://www.fussball.de/ajax.team.matchplan/-/'
}
class MatchplanUrlBuilder {
constructor(teamId, options) {
this.teamId = teamId
Object.assign(defaults, options)
}
buildUrl() {
let params = ""
Object.keys(defaults).filter(item => item != 'baseUrl').forEach((key, index) => {
params += `${paramCase(key)}/${defaults[key]}/`
})
return `${defaults.baseUrl}${params}team-id/${this.teamId}`
}
}
exports.MatchplanUrlBuilder = MatchplanUrlBuilder