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
+3 -4
View File
@@ -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,