✨ feat(substore): 新增 peiqian 和 yuetong 重命名脚本并优化现有脚本注释
This commit is contained in:
+10
-5
@@ -4,6 +4,7 @@
|
||||
* - 清理常见冗余线路描述,例如 DIP 地区说明、IEPL 专线
|
||||
* - 基于归一化后的完整名称做精准去重
|
||||
*/
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
function operator(proxies) {
|
||||
const globalCount = Object.create(null);
|
||||
const currentCount = Object.create(null);
|
||||
@@ -552,7 +553,10 @@ function operator(proxies) {
|
||||
);
|
||||
Object.values(flagCodeOverrides).forEach(code => knownRegionCodes.add(code));
|
||||
|
||||
const escapeRegex = value => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const regexSpecialChars = new Set(['.', '*', '+', '?', '^', '$', '{', '}', '(', ')', '|', '[', ']', '\\']);
|
||||
const escapeRegex = value => [...value]
|
||||
.map(char => regexSpecialChars.has(char) ? `\\${char}` : char)
|
||||
.join('');
|
||||
const leadingFlagRegex = /^([\u{1F1E6}-\u{1F1FF}]{2}|🏴☠️)\s*/u;
|
||||
const inlineFlagRegex = /^(.{1,24}?)([\u{1F1E6}-\u{1F1FF}]{2}|🏴☠️)\s*(.*)$/u;
|
||||
|
||||
@@ -692,15 +696,16 @@ function operator(proxies) {
|
||||
}
|
||||
|
||||
core = core
|
||||
.replace(/\[DIP[^\]]*\]/gi, '[DIP]');
|
||||
.replace(/\[DIP.*?]/gi, '[DIP]');
|
||||
|
||||
core = normalizeBilingualName(core);
|
||||
core = normalizeLeadingRegion(core);
|
||||
|
||||
if (/^Pro-\s*/i.test(core)) {
|
||||
core = core.replace(/^(Pro-\s*)(.+)$/i, (fullMatch, proPrefix, restName) => {
|
||||
return `${proPrefix}${normalizeLeadingRegion(restName)}`;
|
||||
});
|
||||
const proMatch = core.match(/^(Pro-\s*)(.+)$/i);
|
||||
if (proMatch) {
|
||||
core = `${proMatch[1]}${normalizeLeadingRegion(proMatch[2])}`;
|
||||
}
|
||||
}
|
||||
|
||||
core = core
|
||||
|
||||
Reference in New Issue
Block a user