♻️ refactor(substore): 优化节点重命名规则并规范化地区序列号格式
This commit is contained in:
+14
-1
@@ -676,6 +676,19 @@ function operator(proxies) {
|
||||
return `${nameWithoutMultiplier} ${multipliers.join(' ')}`.trim();
|
||||
};
|
||||
|
||||
const normalizeRegionSequence = name => name
|
||||
.replace(/(^|\s)([A-Z]{2}(?:\s+[A-Z]{3})?)[\s|\-]*(\d{1,2})(?=$|[\s|\-[\]])/g, (
|
||||
match,
|
||||
prefix,
|
||||
regionCode,
|
||||
sequenceNumber
|
||||
) => {
|
||||
return `${prefix}${regionCode} ${sequenceNumber.padStart(2, '0')}`;
|
||||
})
|
||||
.replace(/(\b[A-Z]{2}(?:\s+[A-Z]{3})? \d{2})-\s*(?=\d+(?:\.\d+)?X\b)/g, '$1 ')
|
||||
.replace(/\s{2,}/g, ' ')
|
||||
.trim();
|
||||
|
||||
const normalizeBilingualName = name => {
|
||||
const bilingualMatch = name.match(/^(.+?)\s*|\s*(.+)$/);
|
||||
if (!bilingualMatch) return name;
|
||||
@@ -740,7 +753,7 @@ function operator(proxies) {
|
||||
core = joinAlias(flagRegionCode, core);
|
||||
}
|
||||
|
||||
core = moveMultiplierToEnd(simplifyCoreName(core));
|
||||
core = normalizeRegionSequence(moveMultiplierToEnd(simplifyCoreName(core)));
|
||||
|
||||
return flag ? `${flag} ${core}` : core;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user