refactor: replace 'let' with 'const' for better variable scoping and immutability

This commit is contained in:
Tunglies
2025-09-18 23:07:18 +08:00
parent 9d96ac0f6a
commit 324628dd3d
17 changed files with 154 additions and 121 deletions

View File

@@ -217,20 +217,19 @@ export async function getProxies(): Promise<{
}, []);
if (global?.all) {
let globalGroups: IProxyGroupItem[] = global.all.reduce<IProxyGroupItem[]>(
(acc, name) => {
if (proxyRecord[name]?.all) {
acc.push({
...proxyRecord[name],
all: proxyRecord[name].all!.map((item) => generateItem(item)),
});
}
return acc;
},
[],
);
const globalGroups: IProxyGroupItem[] = global.all.reduce<
IProxyGroupItem[]
>((acc, name) => {
if (proxyRecord[name]?.all) {
acc.push({
...proxyRecord[name],
all: proxyRecord[name].all!.map((item) => generateItem(item)),
});
}
return acc;
}, []);
let globalNames = new Set(globalGroups.map((each) => each.name));
const globalNames = new Set(globalGroups.map((each) => each.name));
groups = groups
.filter((group) => {
return !globalNames.has(group.name);
@@ -674,7 +673,7 @@ export async function saveWebdavConfig(
}
export async function listWebDavBackup() {
let list: IWebDavFile[] = await invoke<IWebDavFile[]>("list_webdav_backup");
const list: IWebDavFile[] = await invoke<IWebDavFile[]>("list_webdav_backup");
list.map((item) => {
item.filename = item.href.split("/").pop() as string;
});