♻️ refactor(substore): 将倍率标识移动到节点名称末尾
This commit is contained in:
+16
-1
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user