more refactoring ✨
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user