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
+2 -2
View File
@@ -27,7 +27,7 @@ export function scriptCalculateOfflineProduction(runningScript: RunningScript):
//Data map: [MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
// Grow
for (const hostname in runningScript.dataMap) {
for (const hostname of Object.keys(runningScript.dataMap)) {
if (runningScript.dataMap.hasOwnProperty(hostname)) {
if (runningScript.dataMap[hostname][2] == 0 || runningScript.dataMap[hostname][2] == null) {
continue;
@@ -60,7 +60,7 @@ export function scriptCalculateOfflineProduction(runningScript: RunningScript):
runningScript.offlineExpGained += expGain;
// Weaken
for (const hostname in runningScript.dataMap) {
for (const hostname of Object.keys(runningScript.dataMap)) {
if (runningScript.dataMap.hasOwnProperty(hostname)) {
if (runningScript.dataMap[hostname][3] == 0 || runningScript.dataMap[hostname][3] == null) {
continue;