mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
cleanup
This commit is contained in:
@@ -289,22 +289,21 @@ export async function getStats(
|
|||||||
|
|
||||||
const main = await getOfficialStats(rsn, 'main', options?.axiosConfigs?.main);
|
const main = await getOfficialStats(rsn, 'main', options?.axiosConfigs?.main);
|
||||||
|
|
||||||
|
const emptyResponse: HiscoresResponse = {
|
||||||
|
skills: [],
|
||||||
|
activities: []
|
||||||
|
};
|
||||||
const getModeStats = async (
|
const getModeStats = async (
|
||||||
mode: Extract<Gamemode, 'ironman' | 'hardcore' | 'ultimate'>
|
mode: Extract<Gamemode, 'ironman' | 'hardcore' | 'ultimate'>
|
||||||
): Promise<HiscoresResponse | undefined> => {
|
): Promise<HiscoresResponse | undefined> =>
|
||||||
if (!otherGamemodes.includes(mode)) {
|
otherGamemodes.includes(mode)
|
||||||
return { skills: [], activities: [] };
|
? getOfficialStats(rsn, mode, options?.axiosConfigs?.[mode])
|
||||||
}
|
.catch(err => err)
|
||||||
|
: emptyResponse;
|
||||||
try {
|
|
||||||
return await getOfficialStats(rsn, mode, options?.axiosConfigs?.[mode]);
|
|
||||||
} catch {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const formattedName = shouldGetFormattedRsn
|
const formattedName = shouldGetFormattedRsn
|
||||||
? await getRSNFormat(rsn, options?.axiosConfigs?.rsn).catch(() => undefined)
|
? await getRSNFormat(rsn, options?.axiosConfigs?.rsn).catch(
|
||||||
|
() => undefined
|
||||||
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const player: Player = {
|
const player: Player = {
|
||||||
|
|||||||
Reference in New Issue
Block a user