Refactor for ... in loops

This commit is contained in:
nickofolas
2022-01-15 18:45:03 -06:00
parent d5c3d89613
commit ab841f7530
54 changed files with 128 additions and 130 deletions
+4 -4
View File
@@ -46,25 +46,25 @@ export function Companies(): React.ReactElement {
}
function tonsOfRepCompanies(): void {
for (const c in AllCompanies) {
for (const c of Object.keys(AllCompanies)) {
AllCompanies[c].playerReputation = bigNumber;
}
}
function resetAllRepCompanies(): void {
for (const c in AllCompanies) {
for (const c of Object.keys(AllCompanies)) {
AllCompanies[c].playerReputation = 0;
}
}
function tonsOfFavorCompanies(): void {
for (const c in AllCompanies) {
for (const c of Object.keys(AllCompanies)) {
AllCompanies[c].favor = bigNumber;
}
}
function resetAllFavorCompanies(): void {
for (const c in AllCompanies) {
for (const c of Object.keys(AllCompanies)) {
AllCompanies[c].favor = 0;
}
}
+5 -5
View File
@@ -36,7 +36,7 @@ export function Factions(props: IProps): React.ReactElement {
}
function receiveAllInvites(): void {
for (const i in AllFaction) {
for (const i of Object.keys(AllFaction)) {
props.player.receiveInvite(AllFaction[i].name);
}
}
@@ -74,25 +74,25 @@ export function Factions(props: IProps): React.ReactElement {
}
function tonsOfRep(): void {
for (const i in AllFaction) {
for (const i of Object.keys(AllFaction)) {
AllFaction[i].playerReputation = bigNumber;
}
}
function resetAllRep(): void {
for (const i in AllFaction) {
for (const i of Object.keys(AllFaction)) {
AllFaction[i].playerReputation = 0;
}
}
function tonsOfFactionFavor(): void {
for (const i in AllFaction) {
for (const i of Object.keys(AllFaction)) {
AllFaction[i].favor = bigNumber;
}
}
function resetAllFactionFavor(): void {
for (const i in AllFaction) {
for (const i of Object.keys(AllFaction)) {
AllFaction[i].favor = 0;
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ export function Programs(props: IProps): React.ReactElement {
}
function addAllPrograms(): void {
for (const i in AllPrograms) {
for (const i of Object.keys(AllPrograms)) {
if (!props.player.hasProgram(AllPrograms[i].name)) {
props.player.getHomeComputer().programs.push(AllPrograms[i].name);
}
+1 -1
View File
@@ -38,7 +38,7 @@ export function StockMarket(): React.ReactElement {
};
}
for (const name in SM) {
for (const name of Object.keys(SM)) {
if (SM.hasOwnProperty(name)) {
const stock = SM[name];
if (stock instanceof Stock && match(stock.symbol)) {