Skip to content

Commit

Permalink
chore: biome fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Geczy committed May 17, 2024
1 parent bff02ba commit c084ec9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
22 changes: 15 additions & 7 deletions packages/dota/src/dota/events/minimap/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,21 @@ class MinimapParser {
}
}

if (!data.hero || !data.player || !data.map || !data.minimap) {
return {
status: {
active: false,
},
}
}

// Parse Status
const status: any = {
active: true,
paused: this.isGamePaused(data.map!),
playing: this.isPlaying(data.player!),
hero: this.isPlaying(data.player!) ? data.hero?.name : data.hero?.team2?.player0.name,
team: this.isPlaying(data.player!) ? data.player?.team_name : 'radiant',
paused: this.isGamePaused(data.map),
playing: this.isPlaying(data.player),
hero: this.isPlaying(data.player) ? data.hero?.name : data.hero?.team2?.player0.name,
team: this.isPlaying(data.player) ? data.player?.team_name : 'radiant',
}

// Parse Minimap
Expand All @@ -219,10 +227,11 @@ class MinimapParser {
tp: [],
scan: [],
}
const entities = Object.keys(data.minimap!)
const entities = Object.keys(data.minimap)

entities.forEach((key) => {
const entity = data.minimap?.[key]
if (!entity) return

// Heroes
if (
Expand Down Expand Up @@ -285,5 +294,4 @@ class MinimapParser {
}
}

const minimapParser = new MinimapParser()
export default minimapParser
export default MinimapParser
6 changes: 3 additions & 3 deletions packages/steam/src/steam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Dota2.Dota2Client.prototype.spectateFriendGame = function (
friend: { steam_id: number; live: boolean },
callback: any,
) {
callback = callback || null
const localCallback = callback || null
if (!this._gcReady) {
logger.info("[STEAM] GC not ready, please listen for the 'ready' event.")
return null
Expand All @@ -58,7 +58,7 @@ Dota2.Dota2Client.prototype.spectateFriendGame = function (
Dota2.schema.EDOTAGCMsg.k_EMsgGCSpectateFriendGame,
payload,
onGCSpectateFriendGameResponse,
callback,
localCallback,
)
}

Expand Down Expand Up @@ -428,7 +428,7 @@ class Dota {
(oldest, [key, entry]) => {
if (!oldest) return key
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return entry.timestamp < this.cache.get(oldest)?.timestamp ? key : oldest
return entry.timestamp < (this.cache.get(oldest)?.timestamp || 0) ? key : oldest
},
null as number | null,
)
Expand Down

0 comments on commit c084ec9

Please sign in to comment.