blob: c9f56289bb9ef4bd008ce15d420a4c7f507906e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { HypixelPlayerStatsSkyBlockProfiles } from "../../hypixelApi"
import { CleanBasicProfile, CleanProfile, cleanSkyblockProfileResponse, cleanSkyblockProfileResponseLighter } from "./profile"
export function cleanPlayerSkyblockProfiles(rawProfiles: HypixelPlayerStatsSkyBlockProfiles): CleanBasicProfile[] {
let profiles: CleanBasicProfile[] = []
for (const profile of Object.values(rawProfiles ?? {})) {
profiles.push({
uuid: profile.profile_id,
name: profile.cute_name
})
}
return profiles
}
/** Convert an array of raw profiles into clean profiles */
export async function cleanSkyblockProfilesResponse(data: any[]): Promise<CleanProfile[]> {
const cleanedProfiles: CleanProfile[] = []
for (const profile of data ?? []) {
// let cleanedProfile = await cleanSkyblockProfileResponseLighter(profile)
let cleanedProfile = await cleanSkyblockProfileResponse(profile)
cleanedProfiles.push(cleanedProfile)
}
return cleanedProfiles
}
|