Skip to content

Commit

Permalink
refactor: 🚨 use for of loop when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 9, 2024
1 parent 126c9b1 commit bcc93bc
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/viewer/SatelliteGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ class SatelliteGroups {
this.selectedGroup = group;
if (!group) {
this.clearSelect();
return;
}
}

forEach (callback: (satId: number) => void) {
for (let i = 0; i < this.sats.length; i++) {
callback(this.sats[i].satId);
for (const sat of this.sats) {
callback(sat.satId);
}
}

Expand All @@ -55,21 +54,21 @@ class SatelliteGroups {

reloadGroups () {
const keys = Object.keys(this.groups);
for (let i = 0; i < keys.length; i++) {
this.groups[keys[i]].reload();
for (const key of keys) {
this.groups[key].reload();
}
}

resetConfig (satelliteGroups: SatelliteGroup[]) {
const groupConfigs = satelliteGroups;
for (let i = 0; i < groupConfigs.length; i++) {
logger.debug(`registering satellite group ${groupConfigs[i].name} (id: ${groupConfigs[i].id})`);
this.groups[groupConfigs[i].id.toLowerCase()] = new SatGroup(
groupConfigs[i].id.toLowerCase(),
groupConfigs[i].name,
groupConfigs[i].groupType,
groupConfigs[i].data,
this.satelliteStore as SatelliteStore
for (const groupConfig of groupConfigs) {
logger.debug(`registering satellite group ${groupConfig.name} (id: ${groupConfig.id})`);
this.groups[groupConfig.id.toLowerCase()] = new SatGroup(
groupConfig.id.toLowerCase(),
groupConfig.name,
groupConfig.groupType,
groupConfig.data,
this.satelliteStore
);
}
}
Expand Down

0 comments on commit bcc93bc

Please sign in to comment.