mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 21:07:27 +00:00
25 lines
No EOL
642 B
JavaScript
25 lines
No EOL
642 B
JavaScript
class MatchHelper {
|
|
getRoleName(timeline) {
|
|
if (timeline.lane === 'BOTTOM' && timeline.role.includes('SUPPORT')) {
|
|
return 'SUPPORT'
|
|
}
|
|
return timeline.lane
|
|
}
|
|
|
|
/**
|
|
* Return time in a formatted way
|
|
* @param sec : time in seconds to convert
|
|
*/
|
|
secToTime(sec) {
|
|
const min = Math.floor(sec / 60)
|
|
const newSec = sec - min * 60
|
|
return min + 'm' + (newSec < 10 ? '0' + newSec : newSec) + 's'
|
|
}
|
|
|
|
sortTeamByRole(a, b) {
|
|
const sortingArr = ['TOP', 'JUNGLE', 'MIDDLE', 'BOTTOM', 'SUPPORT']
|
|
return sortingArr.indexOf(a.role) - sortingArr.indexOf(b.role)
|
|
}
|
|
}
|
|
|
|
module.exports = new MatchHelper() |