Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit ed9fb82

Browse files
author
koops76
committed
Replace for...in loops with iterating over the object's keys
1 parent ac20656 commit ed9fb82

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

chromium/background.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
})
5656
chrome.storage.onChanged.addListener(function (changes, areaName) {
5757
if (areaName === 'sync' || areaName === 'local') {
58-
for (const key in changes) {
58+
for (const key of changes.keys) {
5959
if (key === 'httpNowhere') {
6060
httpNowhereOn = changes[key].newValue
6161
window.updateState()
@@ -390,7 +390,7 @@
390390
function objSize (obj) {
391391
if (typeof obj === 'undefined') return 0
392392
let size = 0
393-
for (const key in obj) {
393+
for (const key of obj.keys) {
394394
if (obj.hasOwnProperty(key)) size++
395395
}
396396
return size
@@ -407,7 +407,7 @@
407407
return []
408408
}
409409
const tabInfo = window.switchPlannerInfo[tabId][rewritten]
410-
for (const assetHost in tabInfo) {
410+
for (const assetHost of tabInfo.keys) {
411411
const ah = tabInfo[assetHost]
412412
const activeCount = objSize(ah[1])
413413
const passiveCount = objSize(ah[0])
@@ -472,7 +472,7 @@
472472
function linksFromKeys (map) {
473473
if (typeof map === 'undefined') return ''
474474
let output = ''
475-
for (const key in map) {
475+
for (const key of map.keys) {
476476
if (map.hasOwnProperty(key)) {
477477
output += "<a href='" + key + "'>" + key + '</a><br/>'
478478
}

chromium/popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
const activeTab = tabArray[0]
132132
const rulesets = backgroundPage.activeRulesets.getRulesets(activeTab.id)
133133

134-
for (const r in rulesets) {
134+
for (const r of rulesets.keys) {
135135
let listDiv = stableRules
136136
if (!rulesets[r].defaultState) {
137137
listDiv = unstableRules

0 commit comments

Comments
 (0)