refactor to ES modules
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
export default class Transform {
|
||||
static championshipsToLocations(championships) {
|
||||
return Transform.unique(Transform.flatten(championships))
|
||||
}
|
||||
|
||||
static flatten(object) {
|
||||
return Object.values(object).reduce((arr, t) => arr.concat(Object.values(t)), [])
|
||||
}
|
||||
|
||||
static unique(array) {
|
||||
return [...new Set(array)]
|
||||
}
|
||||
|
||||
static dropChampionshipsBefore(championshipsToday, time) {
|
||||
return Object.keys(championshipsToday).filter((t) => parseInt(t) >= time)
|
||||
}
|
||||
|
||||
static time(time) {
|
||||
return Math.floor(time/60).toString().padStart(2, '0') + ":" + (time % 60).toString().padStart(2, '0')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user