more refactoring

This commit is contained in:
cnachtigall1991
2021-10-13 21:10:40 +02:00
parent 93d0cdbdc4
commit f536a0527f
8 changed files with 158 additions and 301 deletions

View File

@@ -10,6 +10,39 @@ export const GetWinLoss = (matchResult, teamId) => {
}
}
export const truncate = (str, len, ending) => {
if (len == null)
len = 100
if (ending == null)
ending = '..'
if (str.length > len)
return str.substring(0, len - ending.length) + ending
else
return str
}
export const checkStatEmpty = (stat) => {
if (stat)
return stat
return 0
}
export const getPlayerArr = (stats, team) => {
let arr = []
for (let i = (team - 1) * 5; i < team * 5; i++) {
arr.push({
value: truncate(stats[i].player.name, 15),
textStyle: {
color: 'white'
}
})
}
arr.reverse()
return arr
}
export const TrackMe = async (id64, authcode, sharecode) => {
let statusError = ''
let status = 200