diff options
author | mat-1 <github@matdoes.dev> | 2021-02-28 07:23:42 +0000 |
---|---|---|
committer | mat-1 <github@matdoes.dev> | 2021-02-28 07:23:42 +0000 |
commit | 3fb0c21c294a4ff02353e5726d5ef1c21c39cb0d (patch) | |
tree | dee9c60e13ba2876b02791cc10d8d16b3bb6cc06 /build/cleaners/skyblock/profile.js | |
parent | 6dadf95683a8b8574976c9d024b0b148521012f7 (diff) | |
download | skyblock-api-3fb0c21c294a4ff02353e5726d5ef1c21c39cb0d.tar.gz skyblock-api-3fb0c21c294a4ff02353e5726d5ef1c21c39cb0d.tar.bz2 skyblock-api-3fb0c21c294a4ff02353e5726d5ef1c21c39cb0d.zip |
Compiled TS into JS
Diffstat (limited to 'build/cleaners/skyblock/profile.js')
-rw-r--r-- | build/cleaners/skyblock/profile.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js index fe1161e..3a6bc6f 100644 --- a/build/cleaners/skyblock/profile.js +++ b/build/cleaners/skyblock/profile.js @@ -26,13 +26,14 @@ exports.cleanSkyblockProfileResponseLighter = cleanSkyblockProfileResponseLighte * This function is somewhat costly and shouldn't be called often. Use cleanSkyblockProfileResponseLighter if you don't need all the data */ async function cleanSkyblockProfileResponse(data, options) { - const cleanedMembers = []; + // We use Promise.all so it can fetch all the users at once instead of waiting for the previous promise to complete + const promises = []; for (const memberUUID in data.members) { const memberRaw = data.members[memberUUID]; memberRaw.uuid = memberUUID; - const member = await member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats', (options === null || options === void 0 ? void 0 : options.mainMemberUuid) === memberUUID ? 'inventories' : undefined]); - cleanedMembers.push(member); + promises.push(member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats', (options === null || options === void 0 ? void 0 : options.mainMemberUuid) === memberUUID ? 'inventories' : undefined])); } + const cleanedMembers = await Promise.all(promises); const memberMinions = []; for (const member of cleanedMembers) { memberMinions.push(member.minions); |