Minor changes here and there

This commit is contained in:
SukkaW
2024-02-06 15:49:51 +08:00
parent b7cae1061c
commit 7b2334ee3b
11 changed files with 37 additions and 82 deletions

View File

@@ -24,15 +24,9 @@ const REQUIRE_REWRITE = {
export const surgeRulesetToClashClassicalTextRuleset = (rules: string[] | Set<string>) => {
const trie = Trie.from(rules);
return CLASH_SUPPORTED_RULE_TYPE.flatMap(
type => trie.find(`${type},`)
).concat(
Object.keys(REQUIRE_REWRITE).flatMap(
(type) => {
const found = trie.find(`${type},`);
return found.map(line => `${REQUIRE_REWRITE[type as keyof typeof REQUIRE_REWRITE]}${line.slice(type.length)}`);
}
)
return CLASH_SUPPORTED_RULE_TYPE.flatMap(type => trie.find(`${type},`)).concat(
Object.keys(REQUIRE_REWRITE).flatMap((type) => trie.find(`${type},`)
.map(line => `${REQUIRE_REWRITE[type as keyof typeof REQUIRE_REWRITE]}${line.slice(type.length)}`))
);
};