♻️ refactor(substore): 将倍率标识移动到节点名称末尾

This commit is contained in:
Orion
2026-06-03 10:30:26 +08:00
parent 07ef71bf4a
commit 26bcb3062a
2 changed files with 19 additions and 1 deletions
+16 -1
View File
@@ -661,6 +661,21 @@ function operator(proxies) {
.trim();
};
const moveMultiplierToEnd = name => {
const multipliers = [];
const nameWithoutMultiplier = name
.replace(/\b(\d+(?:\.\d+)?X)\b/gi, multiplier => {
multipliers.push(multiplier.toUpperCase());
return ' ';
})
.replace(/\s+\[/g, ' [')
.replace(/\s{2,}/g, ' ')
.trim();
if (!multipliers.length) return name;
return `${nameWithoutMultiplier} ${multipliers.join(' ')}`.trim();
};
const normalizeBilingualName = name => {
const bilingualMatch = name.match(/^(.+?)\s*\s*(.+)$/);
if (!bilingualMatch) return name;
@@ -725,7 +740,7 @@ function operator(proxies) {
core = joinAlias(flagRegionCode, core);
}
core = simplifyCoreName(core);
core = moveMultiplierToEnd(simplifyCoreName(core));
return flag ? `${flag} ${core}` : core;
};