aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/profiles.ts
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-02-13 14:35:58 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-02-13 14:35:58 -0600
commit68c07e7a5ab8acf5ba7785eed594497e05467061 (patch)
treebf29688d541e817ea1d7e1dbdb0c83233a643530 /src/cleaners/skyblock/profiles.ts
parentf1c18020d5d86aac6119c842e6a108d99fae6e51 (diff)
downloadskyblock-api-68c07e7a5ab8acf5ba7785eed594497e05467061.tar.gz
skyblock-api-68c07e7a5ab8acf5ba7785eed594497e05467061.tar.bz2
skyblock-api-68c07e7a5ab8acf5ba7785eed594497e05467061.zip
create member, profile, and profiles cleaners
Diffstat (limited to 'src/cleaners/skyblock/profiles.ts')
-rw-r--r--src/cleaners/skyblock/profiles.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cleaners/skyblock/profiles.ts b/src/cleaners/skyblock/profiles.ts
new file mode 100644
index 0000000..c942a14
--- /dev/null
+++ b/src/cleaners/skyblock/profiles.ts
@@ -0,0 +1,24 @@
+import { HypixelPlayerStatsSkyBlockProfiles } from "../../hypixelApi"
+import { CleanBasicProfile, CleanProfile, 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
+ })
+ }
+ console.log('cleanPlayerSkyblockProfiles', profiles)
+ 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)
+ cleanedProfiles.push(cleanedProfile)
+ }
+ return cleanedProfiles
+}