aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/objectives.ts
blob: 3427f1f3b281e6c87928e9da5509b7f3a6c0993c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export interface Objective {
	name: string
	completed: boolean
}

export function cleanObjectives(data: any): 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
}