2020-02-01 14:52:56 +00:00
|
|
|
/**
|
|
|
|
|
* League of Legends seasons timestamps
|
|
|
|
|
*/
|
|
|
|
|
const seasons = {
|
|
|
|
|
0: 9,
|
|
|
|
|
1578628800000: 10
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-01 14:20:49 +00:00
|
|
|
module.exports = {
|
2020-02-01 14:52:56 +00:00
|
|
|
seasons,
|
|
|
|
|
/**
|
|
|
|
|
* Get season number for a match
|
|
|
|
|
*/
|
|
|
|
|
getSeasonNumber(timestamp) {
|
|
|
|
|
const arrSeasons = Object.keys(seasons)
|
|
|
|
|
arrSeasons.push(timestamp)
|
|
|
|
|
arrSeasons.sort()
|
|
|
|
|
const indexSeason = arrSeasons.indexOf(timestamp) - 1
|
|
|
|
|
return seasons[arrSeasons[indexSeason]]
|
|
|
|
|
},
|
2019-12-01 14:20:49 +00:00
|
|
|
/**
|
2020-02-01 14:52:56 +00:00
|
|
|
*
|
|
|
|
|
* Sort array of Roles according to a specific order
|
|
|
|
|
* @param a first role
|
|
|
|
|
* @param b second role
|
|
|
|
|
*/
|
2019-12-01 14:20:49 +00:00
|
|
|
sortTeamByRole(a, b) {
|
|
|
|
|
const sortingArr = ['TOP', 'JUNGLE', 'MIDDLE', 'BOTTOM', 'SUPPORT']
|
|
|
|
|
return sortingArr.indexOf(a.role) - sortingArr.indexOf(b.role)
|
|
|
|
|
},
|
|
|
|
|
}
|