aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/objectives.ts
blob: 2443f77e8efbbaeb570464a35648716b296891c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import typedHypixelApi from 'typed-hypixel-api'


export interface Objective {
	name: string
	completed: boolean
}

export function cleanObjectives(data: typedHypixelApi.SkyBlockProfileMember): Objective[] {
	const rawObjectives = data?.objectives || {}
	const objectives: Objective[] = []
	for (const rawObjectiveName in rawObjectives) {
		const rawObjectiveValue = rawObjectives[rawObjectiveName]
		objectives.push({
			name: rawObjectiveName,
			completed: rawObjectiveValue.status === 'COMPLETE',
		})
	}
	return objectives
}