added player metadata
All checks were successful
CSGOWTF/csgowtf/pipeline/head This commit looks good

This commit is contained in:
2021-10-24 15:54:05 +02:00
parent 2d1afc637f
commit c105289971
3 changed files with 196 additions and 54 deletions

View File

@@ -80,3 +80,22 @@ export const GetAvgRank = (stats) => {
return count === 0 ? 0 : Math.floor(fullRank / count)
}
export const sortObjectValue = (obj, direction = 'asc') => {
const sortable = []
for (let key in obj) {
sortable.push([key, obj[key]])}
if (direction === 'asc') {
sortable.sort((a, b) => {
return a[1] - b[1]
})
}
if (direction === 'desc') {
sortable.sort((a, b) => {
return b[1] - a[1]
})
}
return sortable
}