aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/stats.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/cleaners/skyblock/stats.ts')
-rw-r--r--src/cleaners/skyblock/stats.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cleaners/skyblock/stats.ts b/src/cleaners/skyblock/stats.ts
index 1222582..99aa1f7 100644
--- a/src/cleaners/skyblock/stats.ts
+++ b/src/cleaners/skyblock/stats.ts
@@ -61,13 +61,15 @@ export interface CleanProfileStats {
}
}
-export function cleanProfileStats(statsRaw: any): CleanProfileStats {
+export function cleanProfileStats(data: any): CleanProfileStats {
// TODO: add type for statsRaw (probably in hypixelApi.ts since its coming from there)
const stats: CleanProfileStats = {}
- for (let statNameRaw in statsRaw) {
+ const rawStats = data?.stats ?? {}
+ for (const statNameRaw in rawStats) {
+ const statValue = rawStats[statNameRaw]
let { category: statCategory, name: statName } = categorizeStat(statNameRaw)
if (!stats[statCategory]) stats[statCategory] = {}
- stats[statCategory][statName || 'total'] = statsRaw[statNameRaw]
+ stats[statCategory][statName || 'total'] = statValue
}
return stats
}