Skip to content

Commit

Permalink
liniting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ericjohnson97 committed Nov 19, 2023
1 parent 5eee77d commit 7bac506
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/stores/mainVehicle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,19 @@ export const useMainVehicleStore = defineStore('main-vehicle', () => {
return (vehicle as ArduPilot) || undefined
}

/**
* Retrieves the first key from a Map where the associated value matches the specified value.
* @param {Map<string, number>} map
* @param {number} value
* @returns {string | undefined}
*/
function getStringFromValue(map: Map<string, number>, value: number): string | undefined {
for (const [key, val] of map.entries()) {
if (val === value) {
return key;
return key
}
}
return undefined;
return undefined
}

VehicleFactory.onVehicles.once((vehicles: WeakRef<Vehicle.Abstract>[]) => {
Expand Down Expand Up @@ -313,7 +319,7 @@ export const useMainVehicleStore = defineStore('main-vehicle', () => {
vehicleType.value = heartbeat.mavtype.type
lastHeartbeat.value = new Date()
if (modes.value !== undefined) {
mode.value = getStringFromValue(modes.value, heartbeat.custom_mode);
mode.value = getStringFromValue(modes.value, heartbeat.custom_mode)
}
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit 7bac506

Please sign in to comment.