added player metadata
All checks were successful
CSGOWTF/csgowtf/pipeline/head This commit looks good
All checks were successful
CSGOWTF/csgowtf/pipeline/head This commit looks good
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user