diff --git a/src/Alias.ts b/src/Alias.ts
index 0ccc7c27c..b03b3c400 100644
--- a/src/Alias.ts
+++ b/src/Alias.ts
@@ -22,12 +22,12 @@ export function loadGlobalAliases(saveString: string): void {
// Prints all aliases to terminal
export function printAliases(): void {
- for (const name in Aliases) {
+ for (const name of Object.keys(Aliases)) {
if (Aliases.hasOwnProperty(name)) {
Terminal.print("alias " + name + "=" + Aliases[name]);
}
}
- for (const name in GlobalAliases) {
+ for (const name of Object.keys(GlobalAliases)) {
if (GlobalAliases.hasOwnProperty(name)) {
Terminal.print("global alias " + name + "=" + GlobalAliases[name]);
}
diff --git a/src/Augmentation/Augmentation.tsx b/src/Augmentation/Augmentation.tsx
index e357477fe..a47043fde 100644
--- a/src/Augmentation/Augmentation.tsx
+++ b/src/Augmentation/Augmentation.tsx
@@ -526,7 +526,7 @@ export class Augmentation {
// Adds this Augmentation to all Factions
addToAllFactions(): void {
- for (const fac in Factions) {
+ for (const fac of Object.keys(Factions)) {
if (Factions.hasOwnProperty(fac)) {
const facObj: Faction | null = Factions[fac];
if (facObj == null) {
diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx
index 80f709a1f..915e01c33 100644
--- a/src/Augmentation/AugmentationHelpers.tsx
+++ b/src/Augmentation/AugmentationHelpers.tsx
@@ -112,7 +112,7 @@ function getRandomBonus(): any {
}
function initAugmentations(): void {
- for (const name in Factions) {
+ for (const name of Object.keys(Factions)) {
if (Factions.hasOwnProperty(name)) {
Factions[name].augmentations = [];
}
@@ -2498,7 +2498,7 @@ function initAugmentations(): void {
CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]],
Player.queuedAugmentations.length,
);
- for (const name in Augmentations) {
+ for (const name of Object.keys(Augmentations)) {
if (Augmentations.hasOwnProperty(name)) {
Augmentations[name].baseCost *= mult;
}
@@ -2525,7 +2525,7 @@ function applyAugmentation(aug: IPlayerOwnedAugmentation, reapply = false): void
const augObj = Augmentations[aug.name];
// Apply multipliers
- for (const mult in augObj.mults) {
+ for (const mult of Object.keys(augObj.mults)) {
const v = Player.getMult(mult) * augObj.mults[mult];
Player.setMult(mult, v);
}
diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx
index 807d86802..be2c1bf47 100644
--- a/src/Augmentation/ui/PlayerMultipliers.tsx
+++ b/src/Augmentation/ui/PlayerMultipliers.tsx
@@ -17,7 +17,7 @@ function calculateAugmentedStats(): any {
const augP: any = {};
for (const aug of Player.queuedAugmentations) {
const augObj = Augmentations[aug.name];
- for (const mult in augObj.mults) {
+ for (const mult of Object.keys(augObj.mults)) {
const v = augP[mult] ? augP[mult] : 1;
augP[mult] = v * augObj.mults[mult];
}
diff --git a/src/BitNode/BitNode.tsx b/src/BitNode/BitNode.tsx
index 947a2ee65..baacdc4d9 100644
--- a/src/BitNode/BitNode.tsx
+++ b/src/BitNode/BitNode.tsx
@@ -578,7 +578,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
if (p.bitNodeN == null) {
p.bitNodeN = 1;
}
- for (const mult in BitNodeMultipliers) {
+ for (const mult of Object.keys(BitNodeMultipliers)) {
if (BitNodeMultipliers.hasOwnProperty(mult)) {
BitNodeMultipliers[mult] = 1;
}
diff --git a/src/Bladeburner/Action.tsx b/src/Bladeburner/Action.tsx
index 1d71b8a6d..a8012696d 100644
--- a/src/Bladeburner/Action.tsx
+++ b/src/Bladeburner/Action.tsx
@@ -117,7 +117,7 @@ export class Action implements IAction {
// Check to make sure weights are summed properly
let sum = 0;
- for (const weight in this.weights) {
+ for (const weight of Object.keys(this.weights)) {
if (this.weights.hasOwnProperty(weight)) {
sum += this.weights[weight];
}
@@ -131,7 +131,7 @@ export class Action implements IAction {
);
}
- for (const decay in this.decays) {
+ for (const decay of Object.keys(this.decays)) {
if (this.decays.hasOwnProperty(decay)) {
if (this.decays[decay] > 1) {
throw new Error(
@@ -240,7 +240,7 @@ export class Action implements IAction {
}
let difficulty = this.getDifficulty();
let competence = 0;
- for (const stat in this.weights) {
+ for (const stat of Object.keys(this.weights)) {
if (this.weights.hasOwnProperty(stat)) {
const playerStatLvl = Player.queryStatFromString(stat);
const key = "eff" + stat.charAt(0).toUpperCase() + stat.slice(1);
diff --git a/src/Bladeburner/Bladeburner.tsx b/src/Bladeburner/Bladeburner.tsx
index 17e52eb5e..6194f1cea 100644
--- a/src/Bladeburner/Bladeburner.tsx
+++ b/src/Bladeburner/Bladeburner.tsx
@@ -135,7 +135,7 @@ export class Bladeburner implements IBladeburner {
// Can't start a BlackOp if you haven't done the one before it
const blackops = [];
- for (const nm in BlackOperations) {
+ for (const nm of Object.keys(BlackOperations)) {
if (BlackOperations.hasOwnProperty(nm)) {
blackops.push(nm);
}
@@ -1074,7 +1074,7 @@ export class Bladeburner implements IBladeburner {
updateSkillMultipliers(): void {
this.resetSkillMultipliers();
- for (const skillName in this.skills) {
+ for (const skillName of Object.keys(this.skills)) {
if (this.skills.hasOwnProperty(skillName)) {
const skill = Skills[skillName];
if (skill == null) {
diff --git a/src/Bladeburner/ui/BlackOpList.tsx b/src/Bladeburner/ui/BlackOpList.tsx
index 277a87228..834119cbd 100644
--- a/src/Bladeburner/ui/BlackOpList.tsx
+++ b/src/Bladeburner/ui/BlackOpList.tsx
@@ -12,7 +12,7 @@ interface IProps {
export function BlackOpList(props: IProps): React.ReactElement {
let blackops: BlackOperation[] = [];
- for (const blackopName in BlackOperations) {
+ for (const blackopName of Object.keys(BlackOperations)) {
if (BlackOperations.hasOwnProperty(blackopName)) {
blackops.push(BlackOperations[blackopName]);
}
diff --git a/src/Bladeburner/ui/GeneralActionList.tsx b/src/Bladeburner/ui/GeneralActionList.tsx
index b16a51674..5693d4925 100644
--- a/src/Bladeburner/ui/GeneralActionList.tsx
+++ b/src/Bladeburner/ui/GeneralActionList.tsx
@@ -12,7 +12,7 @@ interface IProps {
export function GeneralActionList(props: IProps): React.ReactElement {
const actions: Action[] = [];
- for (const name in GeneralActions) {
+ for (const name of Object.keys(GeneralActions)) {
if (GeneralActions.hasOwnProperty(name)) {
actions.push(GeneralActions[name]);
}
diff --git a/src/Casino/SlotMachine.tsx b/src/Casino/SlotMachine.tsx
index 152edc005..514414e7c 100644
--- a/src/Casino/SlotMachine.tsx
+++ b/src/Casino/SlotMachine.tsx
@@ -157,7 +157,7 @@ export function SlotMachine(props: IProps): React.ReactElement {
function step(): void {
let stoppedOne = false;
const copy = index.slice();
- for (const i in copy) {
+ for (let i = 0; i < copy.length; i++) {
if (copy[i] === locks[i] && !stoppedOne) continue;
copy[i] = (copy[i] + 1) % symbols.length;
stoppedOne = true;
diff --git a/src/Company/Companies.ts b/src/Company/Companies.ts
index 194217b10..0847795eb 100644
--- a/src/Company/Companies.ts
+++ b/src/Company/Companies.ts
@@ -26,7 +26,7 @@ export function initCompanies(): void {
});
// Reset data
- for (const companyName in Companies) {
+ for (const companyName of Object.keys(Companies)) {
const company = Companies[companyName];
const oldCompany = oldCompanies[companyName];
if (!(oldCompany instanceof Company)) {
diff --git a/src/Corporation/Corporation.tsx b/src/Corporation/Corporation.tsx
index b0c11bc70..85b196a74 100644
--- a/src/Corporation/Corporation.tsx
+++ b/src/Corporation/Corporation.tsx
@@ -307,7 +307,7 @@ export class Corporation {
if (upgN === 1) {
for (let i = 0; i < this.divisions.length; ++i) {
const industry = this.divisions[i];
- for (const city in industry.warehouses) {
+ for (const city of Object.keys(industry.warehouses)) {
const warehouse = industry.warehouses[city];
if (warehouse === 0) continue;
if (industry.warehouses.hasOwnProperty(city) && warehouse instanceof Warehouse) {
diff --git a/src/Corporation/Industry.ts b/src/Corporation/Industry.ts
index beb69374f..6831b3118 100644
--- a/src/Corporation/Industry.ts
+++ b/src/Corporation/Industry.ts
@@ -378,7 +378,7 @@ export class Industry implements IIndustry {
updateWarehouseSizeUsed(warehouse: Warehouse): void {
warehouse.updateMaterialSizeUsed();
- for (const prodName in this.products) {
+ for (const prodName of Object.keys(this.products)) {
if (this.products.hasOwnProperty(prodName)) {
const prod = this.products[prodName];
if (prod === undefined) continue;
@@ -414,7 +414,7 @@ export class Industry implements IIndustry {
// Process offices (and the employees in them)
let employeeSalary = 0;
- for (const officeLoc in this.offices) {
+ for (const officeLoc of Object.keys(this.offices)) {
const office = this.offices[officeLoc];
if (office === 0) continue;
if (office instanceof OfficeSpace) {
@@ -470,7 +470,7 @@ export class Industry implements IIndustry {
if (this.warehouses[CorporationConstants.Cities[i]] instanceof Warehouse) {
const wh = this.warehouses[CorporationConstants.Cities[i]];
if (wh === 0) continue;
- for (const name in reqMats) {
+ for (const name of Object.keys(reqMats)) {
if (reqMats.hasOwnProperty(name)) {
wh.materials[name].processMarket();
}
@@ -493,7 +493,7 @@ export class Industry implements IIndustry {
// Process change in demand and competition for this industry's products
processProductMarket(marketCycles = 1): void {
// Demand gradually decreases, and competition gradually increases
- for (const name in this.products) {
+ for (const name of Object.keys(this.products)) {
if (this.products.hasOwnProperty(name)) {
const product = this.products[name];
if (product === undefined) continue;
@@ -531,7 +531,7 @@ export class Industry implements IIndustry {
}
const warehouse = this.warehouses[city];
if (warehouse === 0) continue;
- for (const matName in warehouse.materials) {
+ for (const matName of Object.keys(warehouse.materials)) {
if (warehouse.materials.hasOwnProperty(matName)) {
const mat = warehouse.materials[matName];
mat.imp = 0;
@@ -552,7 +552,7 @@ export class Industry implements IIndustry {
switch (this.state) {
case "PURCHASE": {
/* Process purchase of materials */
- for (const matName in warehouse.materials) {
+ for (const matName of Object.keys(warehouse.materials)) {
if (!warehouse.materials.hasOwnProperty(matName)) continue;
const mat = warehouse.materials[matName];
let buyAmt = 0;
@@ -574,7 +574,7 @@ export class Industry implements IIndustry {
// smart supply
const smartBuy: { [key: string]: number | undefined } = {};
- for (const matName in warehouse.materials) {
+ for (const matName of Object.keys(warehouse.materials)) {
if (!warehouse.materials.hasOwnProperty(matName)) continue;
if (!warehouse.smartSupplyEnabled || !Object.keys(this.reqMats).includes(matName)) continue;
const mat = warehouse.materials[matName];
@@ -591,7 +591,7 @@ export class Industry implements IIndustry {
// Find which material were trying to create the least amount of product with.
let worseAmt = 1e99;
- for (const matName in smartBuy) {
+ for (const matName of Object.keys(smartBuy)) {
const buyAmt = smartBuy[matName];
if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);
const reqMat = this.reqMats[matName];
@@ -601,7 +601,7 @@ export class Industry implements IIndustry {
}
// Align all the materials to the smallest amount.
- for (const matName in smartBuy) {
+ for (const matName of Object.keys(smartBuy)) {
const reqMat = this.reqMats[matName];
if (reqMat === undefined) throw new Error(`reqMat "${matName}" is undefined`);
smartBuy[matName] = worseAmt * reqMat;
@@ -609,7 +609,7 @@ export class Industry implements IIndustry {
// Calculate the total size of all things were trying to buy
let totalSize = 0;
- for (const matName in smartBuy) {
+ for (const matName of Object.keys(smartBuy)) {
const buyAmt = smartBuy[matName];
if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);
totalSize += buyAmt * MaterialSizes[matName];
@@ -618,7 +618,7 @@ export class Industry implements IIndustry {
// Shrink to the size of available space.
const freeSpace = warehouse.size - warehouse.sizeUsed;
if (totalSize > freeSpace) {
- for (const matName in smartBuy) {
+ for (const matName of Object.keys(smartBuy)) {
const buyAmt = smartBuy[matName];
if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);
smartBuy[matName] = Math.floor((buyAmt * freeSpace) / totalSize);
@@ -626,7 +626,7 @@ export class Industry implements IIndustry {
}
// Use the materials already in the warehouse if the option is on.
- for (const matName in smartBuy) {
+ for (const matName of Object.keys(smartBuy)) {
if (!warehouse.smartSupplyUseLeftovers[matName]) continue;
const mat = warehouse.materials[matName];
const buyAmt = smartBuy[matName];
@@ -635,7 +635,7 @@ export class Industry implements IIndustry {
}
// buy them
- for (const matName in smartBuy) {
+ for (const matName of Object.keys(smartBuy)) {
const mat = warehouse.materials[matName];
const buyAmt = smartBuy[matName];
if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);
@@ -672,7 +672,7 @@ export class Industry implements IIndustry {
for (let tmp = 0; tmp < this.prodMats.length; ++tmp) {
totalMatSize += MaterialSizes[this.prodMats[tmp]];
}
- for (const reqMatName in this.reqMats) {
+ for (const reqMatName of Object.keys(this.reqMats)) {
const normQty = this.reqMats[reqMatName];
if (normQty === undefined) continue;
totalMatSize -= MaterialSizes[reqMatName] * normQty;
@@ -692,7 +692,7 @@ export class Industry implements IIndustry {
// Make sure we have enough resource to make our materials
let producableFrac = 1;
- for (const reqMatName in this.reqMats) {
+ for (const reqMatName of Object.keys(this.reqMats)) {
if (this.reqMats.hasOwnProperty(reqMatName)) {
const reqMat = this.reqMats[reqMatName];
if (reqMat === undefined) continue;
@@ -709,7 +709,7 @@ export class Industry implements IIndustry {
// Make our materials if they are producable
if (producableFrac > 0 && prod > 0) {
- for (const reqMatName in this.reqMats) {
+ for (const reqMatName of Object.keys(this.reqMats)) {
const reqMat = this.reqMats[reqMatName];
if (reqMat === undefined) continue;
const reqMatQtyNeeded = reqMat * prod * producableFrac;
@@ -726,7 +726,7 @@ export class Industry implements IIndustry {
Math.pow(warehouse.materials["AICores"].qty, this.aiFac) / 10e3;
}
} else {
- for (const reqMatName in this.reqMats) {
+ for (const reqMatName of Object.keys(this.reqMats)) {
if (this.reqMats.hasOwnProperty(reqMatName)) {
warehouse.materials[reqMatName].prd = 0;
}
@@ -742,7 +742,7 @@ export class Industry implements IIndustry {
//If this doesn't produce any materials, then it only creates
//Products. Creating products will consume materials. The
//Production of all consumed materials must be set to 0
- for (const reqMatName in this.reqMats) {
+ for (const reqMatName of Object.keys(this.reqMats)) {
warehouse.materials[reqMatName].prd = 0;
}
}
@@ -750,7 +750,7 @@ export class Industry implements IIndustry {
case "SALE":
/* Process sale of materials */
- for (const matName in warehouse.materials) {
+ for (const matName of Object.keys(warehouse.materials)) {
if (warehouse.materials.hasOwnProperty(matName)) {
const mat = warehouse.materials[matName];
if (mat.sCost < 0 || mat.sllman[0] === false) {
@@ -881,7 +881,7 @@ export class Industry implements IIndustry {
break;
case "EXPORT":
- for (const matName in warehouse.materials) {
+ for (const matName of Object.keys(warehouse.materials)) {
if (warehouse.materials.hasOwnProperty(matName)) {
const mat = warehouse.materials[matName];
mat.totalExp = 0; //Reset export
@@ -993,7 +993,7 @@ export class Industry implements IIndustry {
//Create products
if (this.state === "PRODUCTION") {
- for (const prodName in this.products) {
+ for (const prodName of Object.keys(this.products)) {
const prod = this.products[prodName];
if (prod === undefined) continue;
if (!prod.fin) {
@@ -1025,7 +1025,7 @@ export class Industry implements IIndustry {
}
//Produce Products
- for (const prodName in this.products) {
+ for (const prodName of Object.keys(this.products)) {
if (this.products.hasOwnProperty(prodName)) {
const prod = this.products[prodName];
if (prod instanceof Product && prod.fin) {
@@ -1067,7 +1067,7 @@ export class Industry implements IIndustry {
//Calculate net change in warehouse storage making the Products will cost
let netStorageSize = product.siz;
- for (const reqMatName in product.reqMats) {
+ for (const reqMatName of Object.keys(product.reqMats)) {
if (product.reqMats.hasOwnProperty(reqMatName)) {
const normQty = product.reqMats[reqMatName];
netStorageSize -= MaterialSizes[reqMatName] * normQty;
@@ -1084,7 +1084,7 @@ export class Industry implements IIndustry {
//Make sure we have enough resources to make our Products
let producableFrac = 1;
- for (const reqMatName in product.reqMats) {
+ for (const reqMatName of Object.keys(product.reqMats)) {
if (product.reqMats.hasOwnProperty(reqMatName)) {
const req = product.reqMats[reqMatName] * prod;
if (warehouse.materials[reqMatName].qty < req) {
@@ -1095,7 +1095,7 @@ export class Industry implements IIndustry {
//Make our Products if they are producable
if (producableFrac > 0 && prod > 0) {
- for (const reqMatName in product.reqMats) {
+ for (const reqMatName of Object.keys(product.reqMats)) {
if (product.reqMats.hasOwnProperty(reqMatName)) {
const reqMatQtyNeeded = product.reqMats[reqMatName] * prod * producableFrac;
warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;
@@ -1114,7 +1114,7 @@ export class Industry implements IIndustry {
case "SALE": {
//Process sale of Products
product.pCost = 0; //Estimated production cost
- for (const reqMatName in product.reqMats) {
+ for (const reqMatName of Object.keys(product.reqMats)) {
if (product.reqMats.hasOwnProperty(reqMatName)) {
product.pCost += product.reqMats[reqMatName] * warehouse.materials[reqMatName].bCost;
}
@@ -1250,7 +1250,7 @@ export class Industry implements IIndustry {
}
discontinueProduct(product: Product): void {
- for (const productName in this.products) {
+ for (const productName of Object.keys(this.products)) {
if (this.products.hasOwnProperty(productName)) {
if (product === this.products[productName]) {
delete this.products[productName];
@@ -1354,7 +1354,7 @@ export class Industry implements IIndustry {
// Since ResearchTree data isnt saved, we'll update the Research Tree data
// based on the stored 'researched' property in the Industry object
if (Object.keys(researchTree.researched).length !== Object.keys(this.researched).length) {
- for (const research in this.researched) {
+ for (const research of Object.keys(this.researched)) {
researchTree.research(research);
}
}
diff --git a/src/Corporation/OfficeSpace.ts b/src/Corporation/OfficeSpace.ts
index 87a835864..dfc0fb963 100644
--- a/src/Corporation/OfficeSpace.ts
+++ b/src/Corporation/OfficeSpace.ts
@@ -103,7 +103,7 @@ export class OfficeSpace {
calculateEmployeeProductivity(corporation: ICorporation, industry: IIndustry): void {
//Reset
- for (const name in this.employeeProd) {
+ for (const name of Object.keys(this.employeeProd)) {
this.employeeProd[name] = 0;
}
diff --git a/src/Corporation/Product.ts b/src/Corporation/Product.ts
index 08b5ef6e7..652f9a3e8 100644
--- a/src/Corporation/Product.ts
+++ b/src/Corporation/Product.ts
@@ -198,7 +198,7 @@ export class Product {
//Calculate the product's required materials
//For now, just set it to be the same as the requirements to make materials
- for (const matName in industry.reqMats) {
+ for (const matName of Object.keys(industry.reqMats)) {
if (industry.reqMats.hasOwnProperty(matName)) {
const reqMat = industry.reqMats[matName];
if (reqMat === undefined) continue;
@@ -209,7 +209,7 @@ export class Product {
//Calculate the product's size
//For now, just set it to be the same size as the requirements to make materials
this.siz = 0;
- for (const matName in industry.reqMats) {
+ for (const matName of Object.keys(industry.reqMats)) {
const reqMat = industry.reqMats[matName];
if (reqMat === undefined) continue;
this.siz += MaterialSizes[matName] * reqMat;
diff --git a/src/Corporation/Warehouse.ts b/src/Corporation/Warehouse.ts
index bba7dabe5..d55a641c6 100644
--- a/src/Corporation/Warehouse.ts
+++ b/src/Corporation/Warehouse.ts
@@ -85,7 +85,7 @@ export class Warehouse {
// Re-calculate how much space is being used by this Warehouse
updateMaterialSizeUsed(): void {
this.sizeUsed = 0;
- for (const matName in this.materials) {
+ for (const matName of Object.keys(this.materials)) {
const mat = this.materials[matName];
if (MaterialSizes.hasOwnProperty(matName)) {
this.sizeUsed += mat.qty * MaterialSizes[matName];
diff --git a/src/Corporation/ui/IndustryOverview.tsx b/src/Corporation/ui/IndustryOverview.tsx
index 1d38363e2..97633225a 100644
--- a/src/Corporation/ui/IndustryOverview.tsx
+++ b/src/Corporation/ui/IndustryOverview.tsx
@@ -215,7 +215,7 @@ function Upgrades(props: { office: OfficeSpace; rerender: () => void }): React.R
const corp = useCorporation();
const division = useDivision();
const upgrades = [];
- for (const index in IndustryUpgrades) {
+ for (const index of Object.keys(IndustryUpgrades)) {
const upgrade = IndustryUpgrades[index];
// AutoBrew research disables the Coffee upgrade
diff --git a/src/Corporation/ui/IndustryWarehouse.tsx b/src/Corporation/ui/IndustryWarehouse.tsx
index eacaa8f8b..9b6c7b474 100644
--- a/src/Corporation/ui/IndustryWarehouse.tsx
+++ b/src/Corporation/ui/IndustryWarehouse.tsx
@@ -81,7 +81,7 @@ function WarehouseRoot(props: IProps): React.ReactElement {
// Create React components for materials
const mats = [];
- for (const matName in props.warehouse.materials) {
+ for (const matName of Object.keys(props.warehouse.materials)) {
if (!(props.warehouse.materials[matName] instanceof Material)) continue;
// Only create UI for materials that are relevant for the industry
if (!isRelevantMaterial(matName, division)) continue;
@@ -99,7 +99,7 @@ function WarehouseRoot(props: IProps): React.ReactElement {
// Create React components for products
const products = [];
if (division.makesProducts && Object.keys(division.products).length > 0) {
- for (const productName in division.products) {
+ for (const productName of Object.keys(division.products)) {
const product = division.products[productName];
if (!(product instanceof Product)) continue;
products.push(
@@ -109,14 +109,14 @@ function WarehouseRoot(props: IProps): React.ReactElement {
}
const breakdownItems: JSX.Element[] = [];
- for (const matName in props.warehouse.materials) {
+ for (const matName of Object.keys(props.warehouse.materials)) {
const mat = props.warehouse.materials[matName];
if (!MaterialSizes.hasOwnProperty(matName)) continue;
if (mat.qty === 0) continue;
breakdownItems.push(<>{matName}: {numeralWrapper.format(mat.qty * MaterialSizes[matName], "0,0.0")}>);
}
- for (const prodName in division.products) {
+ for (const prodName of Object.keys(division.products)) {
const prod = division.products[prodName];
if (prod === undefined) continue;
breakdownItems.push(<>{prodName}: {numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")}>);
diff --git a/src/Corporation/ui/SmartSupplyModal.tsx b/src/Corporation/ui/SmartSupplyModal.tsx
index d853ec2f7..d9438db31 100644
--- a/src/Corporation/ui/SmartSupplyModal.tsx
+++ b/src/Corporation/ui/SmartSupplyModal.tsx
@@ -60,7 +60,7 @@ export function SmartSupplyModal(props: IProps): React.ReactElement {
// Create React components for materials
const mats = [];
- for (const matName in props.warehouse.materials) {
+ for (const matName of Object.keys(props.warehouse.materials)) {
if (!(props.warehouse.materials[matName] instanceof Material)) continue;
if (!Object.keys(division.reqMats).includes(matName)) continue;
mats.push();
diff --git a/src/Crime/CrimeHelpers.ts b/src/Crime/CrimeHelpers.ts
index 70374c648..8ef8ac311 100644
--- a/src/Crime/CrimeHelpers.ts
+++ b/src/Crime/CrimeHelpers.ts
@@ -7,7 +7,7 @@ import { dialogBoxCreate } from "../ui/React/DialogBox";
export function determineCrimeSuccess(p: IPlayer, type: string): boolean {
let chance = 0;
let found = false;
- for (const i in Crimes) {
+ for (const i of Object.keys(Crimes)) {
const crime = Crimes[i];
if (crime.type == type) {
chance = crime.successRate(p);
diff --git a/src/DarkWeb/DarkWeb.tsx b/src/DarkWeb/DarkWeb.tsx
index 4ae97029a..06d4c0f25 100644
--- a/src/DarkWeb/DarkWeb.tsx
+++ b/src/DarkWeb/DarkWeb.tsx
@@ -21,7 +21,7 @@ export function checkIfConnectedToDarkweb(): void {
}
export function listAllDarkwebItems(): void {
- for (const key in DarkWebItems) {
+ for (const key of Object.keys(DarkWebItems)) {
const item = DarkWebItems[key];
const cost = Player.getHomeComputer().programs.includes(item.program) ? (
@@ -44,7 +44,7 @@ export function buyDarkwebItem(itemName: string): void {
// find the program that matches, if any
let item: DarkWebItem | null = null;
- for (const key in DarkWebItems) {
+ for (const key of Object.keys(DarkWebItems)) {
const i = DarkWebItems[key];
if (i.program.toLowerCase() == itemName) {
item = i;
@@ -93,7 +93,7 @@ export function buyAllDarkwebItems(): void {
const itemsToBuy: DarkWebItem[] = [];
let cost = 0;
- for (const key in DarkWebItems) {
+ for (const key of Object.keys(DarkWebItems)) {
const item = DarkWebItems[key];
if (!Player.hasProgram(item.program)) {
itemsToBuy.push(item);
diff --git a/src/DevMenu/ui/Companies.tsx b/src/DevMenu/ui/Companies.tsx
index e5099703a..6553823e8 100644
--- a/src/DevMenu/ui/Companies.tsx
+++ b/src/DevMenu/ui/Companies.tsx
@@ -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;
}
}
diff --git a/src/DevMenu/ui/Factions.tsx b/src/DevMenu/ui/Factions.tsx
index 07b60e2e3..8cdc85e9f 100644
--- a/src/DevMenu/ui/Factions.tsx
+++ b/src/DevMenu/ui/Factions.tsx
@@ -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;
}
}
diff --git a/src/DevMenu/ui/Programs.tsx b/src/DevMenu/ui/Programs.tsx
index fbaacb662..af39aa8b4 100644
--- a/src/DevMenu/ui/Programs.tsx
+++ b/src/DevMenu/ui/Programs.tsx
@@ -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);
}
diff --git a/src/DevMenu/ui/StockMarket.tsx b/src/DevMenu/ui/StockMarket.tsx
index 7be7d0e45..5eaa50a64 100644
--- a/src/DevMenu/ui/StockMarket.tsx
+++ b/src/DevMenu/ui/StockMarket.tsx
@@ -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)) {
diff --git a/src/Faction/FactionHelpers.tsx b/src/Faction/FactionHelpers.tsx
index 2a6aeb143..5cd974735 100644
--- a/src/Faction/FactionHelpers.tsx
+++ b/src/Faction/FactionHelpers.tsx
@@ -34,8 +34,7 @@ export function joinFaction(faction: Faction): void {
const factionInfo = faction.getInfo();
//Determine what factions you are banned from now that you have joined this faction
- for (const i in factionInfo.enemies) {
- const enemy = factionInfo.enemies[i];
+ for (const enemy of factionInfo.enemies) {
if (Factions[enemy] instanceof Faction) {
Factions[enemy].isBanned = true;
}
@@ -121,7 +120,7 @@ export function purchaseAugmentation(aug: Augmentation, fac: Faction, sing = fal
}
}
- for (const name in Augmentations) {
+ for (const name of Object.keys(Augmentations)) {
if (Augmentations.hasOwnProperty(name)) {
Augmentations[name].baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]];
}
@@ -170,7 +169,7 @@ export function getNextNeurofluxLevel(): number {
}
export function processPassiveFactionRepGain(numCycles: number): void {
- for (const name in Factions) {
+ for (const name of Object.keys(Factions)) {
if (name === Player.currentWorkFactionName) continue;
if (!Factions.hasOwnProperty(name)) continue;
const faction = Factions[name];
diff --git a/src/Faction/Factions.ts b/src/Faction/Factions.ts
index 4d7bcb5f0..e06795a88 100644
--- a/src/Faction/Factions.ts
+++ b/src/Faction/Factions.ts
@@ -34,7 +34,7 @@ export function factionExists(name: string): boolean {
}
export function initFactions(): void {
- for (const name in FactionInfos) {
+ for (const name of Object.keys(FactionInfos)) {
resetFaction(new Faction(name));
}
}
diff --git a/src/Faction/ui/AugmentationsPage.tsx b/src/Faction/ui/AugmentationsPage.tsx
index b9cb58477..605abee42 100644
--- a/src/Faction/ui/AugmentationsPage.tsx
+++ b/src/Faction/ui/AugmentationsPage.tsx
@@ -44,7 +44,7 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
function getAugs(): string[] {
if (isPlayersGang) {
const augs: string[] = [];
- for (const augName in Augmentations) {
+ for (const augName of Object.keys(Augmentations)) {
if (augName === AugmentationNames.NeuroFluxGovernor) continue;
if (augName === AugmentationNames.TheRedPill && player.bitNodeN !== 2) continue;
const aug = Augmentations[augName];
diff --git a/src/Gang/Gang.ts b/src/Gang/Gang.ts
index 3f30a9c37..cba26558c 100644
--- a/src/Gang/Gang.ts
+++ b/src/Gang/Gang.ts
@@ -158,7 +158,7 @@ export class Gang implements IGang {
// Process power first
const gangName = this.facName;
- for (const name in AllGangs) {
+ for (const name of Object.keys(AllGangs)) {
if (AllGangs.hasOwnProperty(name)) {
if (name == gangName) {
AllGangs[name].power += this.calculatePower();
diff --git a/src/Hacknet/HashManager.ts b/src/Hacknet/HashManager.ts
index aa2cba24d..d07840e81 100644
--- a/src/Hacknet/HashManager.ts
+++ b/src/Hacknet/HashManager.ts
@@ -24,7 +24,7 @@ export class HashManager {
upgrades: IMap = {};
constructor() {
- for (const name in HashUpgrades) {
+ for (const name of Object.keys(HashUpgrades)) {
this.upgrades[name] = 0;
}
}
@@ -85,7 +85,7 @@ export class HashManager {
}
prestige(): void {
- for (const name in HashUpgrades) {
+ for (const name of Object.keys(HashUpgrades)) {
this.upgrades[name] = 0;
}
this.hashes = 0;
diff --git a/src/Locations/Locations.ts b/src/Locations/Locations.ts
index 1c99e2415..725574767 100644
--- a/src/Locations/Locations.ts
+++ b/src/Locations/Locations.ts
@@ -220,7 +220,7 @@ for (const metadata of LocationsMetadata) {
const cityName = loc.city;
if (cityName === null) {
// Generic location, add to all cities
- for (const city in Cities) {
+ for (const city of Object.keys(Cities)) {
Cities[city].addLocation(loc.name);
}
} else {
diff --git a/src/Locations/ui/City.tsx b/src/Locations/ui/City.tsx
index d0e54a24b..6cee21071 100644
--- a/src/Locations/ui/City.tsx
+++ b/src/Locations/ui/City.tsx
@@ -132,10 +132,10 @@ function ASCIICity(props: IProps): React.ReactElement {
const elems: JSX.Element[] = [];
const lines = props.city.asciiArt.split("\n");
- for (const i in lines) {
+ for (const line of lines) {
elems.push(
-
- {lineElems(lines[i])}
+
+ {lineElems(line)}
,
);
}
diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts
index fc56a9b28..ae122b980 100644
--- a/src/NetscriptFunctions.ts
+++ b/src/NetscriptFunctions.ts
@@ -762,7 +762,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
},
disableLog: function (fn: any): any {
if (fn === "ALL") {
- for (fn in possibleLogs) {
+ for (fn of Object.keys(possibleLogs)) {
workerScript.disableLogs[fn] = true;
}
workerScript.log("disableLog", () => `Disabled logging for all functions`);
@@ -775,7 +775,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
},
enableLog: function (fn: any): any {
if (fn === "ALL") {
- for (fn in possibleLogs) {
+ for (fn of Object.keys(possibleLogs)) {
delete workerScript.disableLogs[fn];
}
workerScript.log("enableLog", () => `Enabled logging for all functions`);
@@ -1302,8 +1302,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("ps", getRamCost(Player, "ps"));
const server = safeGetServer(hostname, "ps");
const processes = [];
- for (const i in server.runningScripts) {
- const script = server.runningScripts[i];
+ for (const script of server.runningScripts) {
processes.push({
filename: script.filename,
threads: script.threads,
diff --git a/src/NetscriptFunctions/Gang.ts b/src/NetscriptFunctions/Gang.ts
index 7d64588b5..f16cbff6f 100644
--- a/src/NetscriptFunctions/Gang.ts
+++ b/src/NetscriptFunctions/Gang.ts
@@ -101,7 +101,7 @@ export function NetscriptGang(player: IPlayer, workerScript: WorkerScript, helpe
helper.updateDynamicRam("getOtherGangInformation", getRamCost(player, "gang", "getOtherGangInformation"));
checkGangApiAccess("getOtherGangInformation");
const cpy: any = {};
- for (const gang in AllGangs) {
+ for (const gang of Object.keys(AllGangs)) {
cpy[gang] = Object.assign({}, AllGangs[gang]);
}
diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts
index 41e860112..c2c5c60aa 100644
--- a/src/NetscriptFunctions/Singularity.ts
+++ b/src/NetscriptFunctions/Singularity.ts
@@ -113,7 +113,7 @@ export function NetscriptSingularity(
// If player has a gang with this faction, return all augmentations.
if (player.hasGangWith(facname)) {
const res = [];
- for (const augName in Augmentations) {
+ for (const augName of Object.keys(Augmentations)) {
if (augName === AugmentationNames.NeuroFluxGovernor) continue;
if (augName === AugmentationNames.TheRedPill && player.bitNodeN !== 2) continue;
const aug = Augmentations[augName];
@@ -165,7 +165,7 @@ export function NetscriptSingularity(
let augs = [];
if (player.hasGangWith(faction)) {
- for (const augName in Augmentations) {
+ for (const augName of Object.keys(Augmentations)) {
if (augName === AugmentationNames.NeuroFluxGovernor) continue;
if (augName === AugmentationNames.TheRedPill && player.bitNodeN !== 2) continue;
const tempAug = Augmentations[augName];
diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts
index a347d09d5..d99b9da6d 100644
--- a/src/NetscriptFunctions/StockMarket.ts
+++ b/src/NetscriptFunctions/StockMarket.ts
@@ -273,7 +273,7 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
const orders: any = {};
const stockMarketOrders = StockMarket["Orders"];
- for (const symbol in stockMarketOrders) {
+ for (const symbol of Object.keys(stockMarketOrders)) {
const orderBook = stockMarketOrders[symbol];
if (orderBook.constructor === Array && orderBook.length > 0) {
orders[symbol] = [];
diff --git a/src/NetscriptFunctions/toNative.ts b/src/NetscriptFunctions/toNative.ts
index da365af67..b468ee6a6 100644
--- a/src/NetscriptFunctions/toNative.ts
+++ b/src/NetscriptFunctions/toNative.ts
@@ -28,7 +28,7 @@ export function toNative(pseudoObj: any): any {
} else {
// Object.
nativeObj = {};
- for (const key in pseudoObj.properties) {
+ for (const key of Object.keys(pseudoObj.properties)) {
const val = pseudoObj.properties[key];
nativeObj[key] = toNative(val);
}
diff --git a/src/NetscriptJSEvaluator.ts b/src/NetscriptJSEvaluator.ts
index ddd41b2f4..9687954af 100644
--- a/src/NetscriptJSEvaluator.ts
+++ b/src/NetscriptJSEvaluator.ts
@@ -240,7 +240,7 @@ function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): Scri
return urlStack;
} catch (err) {
// If there is an error, we need to clean up the URLs.
- for (const url in urlStack) URL.revokeObjectURL(url);
+ for (const url of urlStack) URL.revokeObjectURL(url.url);
throw err;
} finally {
seen.pop();
diff --git a/src/NetscriptWorker.ts b/src/NetscriptWorker.ts
index 16abccc0c..2f5a1b4e1 100644
--- a/src/NetscriptWorker.ts
+++ b/src/NetscriptWorker.ts
@@ -116,7 +116,7 @@ function startNetscript2Script(player: IPlayer, workerScript: WorkerScript): Pro
};
}
- for (const prop in workerScript.env.vars) {
+ for (const prop of Object.keys(workerScript.env.vars)) {
if (typeof workerScript.env.vars[prop] !== "function") continue;
workerScript.env.vars[prop] = wrap(prop, workerScript.env.vars[prop]);
}
@@ -175,7 +175,7 @@ function startNetscript1Script(workerScript: WorkerScript): Promise = {};
function GetServerByIP(ip: string): BaseServer | undefined {
- for (const key in AllServers) {
+ for (const key of Object.keys(AllServers)) {
const server = AllServers[key];
if (server.ip !== ip) continue;
return server;
@@ -30,7 +30,7 @@ function GetServerByIP(ip: string): BaseServer | undefined {
//Returns server object with corresponding hostname
// Relatively slow, would rather not use this a lot
function GetServerByHostname(hostname: string): BaseServer | null {
- for (const key in AllServers) {
+ for (const key of Object.keys(AllServers)) {
const server = AllServers[key];
if (server.hostname == hostname) {
return server;
@@ -58,14 +58,14 @@ export function GetServer(s: string): BaseServer | null {
export function GetAllServers(): BaseServer[] {
const servers: BaseServer[] = [];
- for (const key in AllServers) {
+ for (const key of Object.keys(AllServers)) {
servers.push(AllServers[key]);
}
return servers;
}
export function DeleteServer(serverkey: string): void {
- for (const key in AllServers) {
+ for (const key of Object.keys(AllServers)) {
const server = AllServers[key];
if (server.ip !== serverkey && server.hostname !== serverkey) continue;
delete AllServers[key];
@@ -194,7 +194,7 @@ export function initForeignServers(homeComputer: Server): void {
}
export function prestigeAllServers(): void {
- for (const member in AllServers) {
+ for (const member of Object.keys(AllServers)) {
delete AllServers[member];
}
AllServers = {};
@@ -206,7 +206,7 @@ export function loadAllServers(saveString: string): void {
export function saveAllServers(excludeRunningScripts = false): string {
const TempAllServers = JSON.parse(JSON.stringify(AllServers), Reviver);
- for (const key in TempAllServers) {
+ for (const key of Object.keys(TempAllServers)) {
const server = TempAllServers[key];
if (excludeRunningScripts) {
server.runningScripts = [];
diff --git a/src/StockMarket/OrderProcessing.tsx b/src/StockMarket/OrderProcessing.tsx
index ec015b372..81f5c7b05 100644
--- a/src/StockMarket/OrderProcessing.tsx
+++ b/src/StockMarket/OrderProcessing.tsx
@@ -42,7 +42,7 @@ export function processOrders(
const orderBook = refs.stockMarket["Orders"];
if (orderBook == null) {
const orders: IOrderBook = {};
- for (const name in refs.stockMarket) {
+ for (const name of Object.keys(refs.stockMarket)) {
const stock = refs.stockMarket[name];
if (!(stock instanceof Stock)) {
continue;
diff --git a/src/StockMarket/StockMarket.tsx b/src/StockMarket/StockMarket.tsx
index 46c7cbf20..3fc17595e 100644
--- a/src/StockMarket/StockMarket.tsx
+++ b/src/StockMarket/StockMarket.tsx
@@ -55,7 +55,7 @@ export function placeOrder(
const order = new Order(stock.symbol, shares, price, type, position);
if (StockMarket["Orders"] == null) {
const orders: IOrderBook = {};
- for (const name in StockMarket) {
+ for (const name of Object.keys(StockMarket)) {
const stk = StockMarket[name];
if (!(stk instanceof Stock)) {
continue;
@@ -157,7 +157,7 @@ export function deleteStockMarket(): void {
}
export function initStockMarket(): void {
- for (const stk in StockMarket) {
+ for (const stk of Object.keys(StockMarket)) {
if (StockMarket.hasOwnProperty(stk)) {
delete StockMarket[stk];
}
@@ -169,7 +169,7 @@ export function initStockMarket(): void {
}
const orders: IOrderBook = {};
- for (const name in StockMarket) {
+ for (const name of Object.keys(StockMarket)) {
const stock = StockMarket[name];
if (!(stock instanceof Stock)) {
continue;
@@ -184,7 +184,7 @@ export function initStockMarket(): void {
}
export function initSymbolToStockMap(): void {
- for (const name in StockSymbols) {
+ for (const name of Object.keys(StockSymbols)) {
if (StockSymbols.hasOwnProperty(name)) {
const stock = StockMarket[name];
if (stock == null) {
@@ -198,7 +198,7 @@ export function initSymbolToStockMap(): void {
}
function stockMarketCycle(): void {
- for (const name in StockMarket) {
+ for (const name of Object.keys(StockMarket)) {
const stock = StockMarket[name];
if (!(stock instanceof Stock)) {
continue;
@@ -247,7 +247,7 @@ export function processStockPrices(numCycles = 1): void {
}
const v = Math.random();
- for (const name in StockMarket) {
+ for (const name of Object.keys(StockMarket)) {
const stock = StockMarket[name];
if (!(stock instanceof Stock)) {
continue;
diff --git a/src/StockMarket/data/TickerHeaderFormatData.ts b/src/StockMarket/data/TickerHeaderFormatData.ts
index 53807ec83..42664268b 100644
--- a/src/StockMarket/data/TickerHeaderFormatData.ts
+++ b/src/StockMarket/data/TickerHeaderFormatData.ts
@@ -5,7 +5,7 @@ export const TickerHeaderFormatData = {
longestSymbol: 0,
};
-for (const key in StockSymbols) {
+for (const key of Object.keys(StockSymbols)) {
TickerHeaderFormatData.longestName = Math.max(key.length, TickerHeaderFormatData.longestName);
TickerHeaderFormatData.longestSymbol = Math.max(StockSymbols[key].length, TickerHeaderFormatData.longestSymbol);
}
diff --git a/src/StockMarket/ui/StockTickers.tsx b/src/StockMarket/ui/StockTickers.tsx
index 7452b48d5..c1a2a2a49 100644
--- a/src/StockMarket/ui/StockTickers.tsx
+++ b/src/StockMarket/ui/StockTickers.tsx
@@ -66,7 +66,7 @@ export function StockTickers(props: IProps): React.ReactElement {
}
const tickers: React.ReactElement[] = [];
- for (const stockMarketProp in props.stockMarket) {
+ for (const stockMarketProp of Object.keys(props.stockMarket)) {
const val = props.stockMarket[stockMarketProp];
if (val instanceof Stock) {
// Skip if there's a filter and the stock isnt in that filter
diff --git a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts
index fef48bbc1..7a7317d26 100644
--- a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts
+++ b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts
@@ -204,7 +204,7 @@ export async function determineAllPossibilitiesForTabCompletion(
if (isCommand("buy")) {
const options = [];
- for (const i in DarkWebItems) {
+ for (const i of Object.keys(DarkWebItems)) {
const item = DarkWebItems[i];
options.push(item.program);
}
diff --git a/src/engine.tsx b/src/engine.tsx
index 9f65fc63f..f660beb39 100644
--- a/src/engine.tsx
+++ b/src/engine.tsx
@@ -169,7 +169,7 @@ const Engine: {
},
decrementAllCounters: function (numCycles = 1) {
- for (const counterName in Engine.Counters) {
+ for (const counterName of Object.keys(Engine.Counters)) {
const counter = Engine.Counters[counterName];
if (counter === undefined) throw new Error("counter should not be undefined");
Engine.Counters[counterName] = counter - numCycles;