WebUI: prefer range based for loop

Using `entries()` can also save the work of manually handling the index variable.

PR #23182.
This commit is contained in:
Chocobo1
2025-08-31 21:54:48 +08:00
committed by GitHub
parent b851caa6b9
commit dffd27a879
14 changed files with 61 additions and 82 deletions

View File

@@ -772,9 +772,9 @@ window.qBittorrent.Search ??= (() => {
};
const getPlugin = (name) => {
for (let i = 0; i < searchPlugins.length; ++i) {
if (searchPlugins[i].name === name)
return searchPlugins[i];
for (const searchPlugin of searchPlugins) {
if (searchPlugin.name === name)
return searchPlugin;
}
return null;
@@ -877,8 +877,7 @@ window.qBittorrent.Search ??= (() => {
if (responseJSON.results) {
const results = responseJSON.results;
for (let i = 0; i < results.length; ++i) {
const result = results[i];
for (const result of results) {
const row = {
rowId: state.rowId,
descrLink: result.descrLink,