mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Simplify Trie
This commit is contained in:
@@ -12,7 +12,7 @@ import { readFileByLine } from '../fetch-text-by-line';
|
||||
import { asyncWriteToStream } from '../async-write-to-stream';
|
||||
|
||||
export abstract class RuleOutput<TPreprocessed = unknown> {
|
||||
protected domainTrie = createTrie<string>(null, true);
|
||||
protected domainTrie = createTrie(null, true);
|
||||
protected domainKeywords = new Set<string>();
|
||||
protected domainWildcard = new Set<string>();
|
||||
protected userAgent = new Set<string>();
|
||||
@@ -97,7 +97,7 @@ export abstract class RuleOutput<TPreprocessed = unknown> {
|
||||
}
|
||||
|
||||
addDomain(domain: string) {
|
||||
this.domainTrie.add(domain, domain);
|
||||
this.domainTrie.add(domain);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,8 @@ export abstract class RuleOutput<TPreprocessed = unknown> {
|
||||
}
|
||||
|
||||
addDomainSuffix(domain: string) {
|
||||
return this.addDomain(domain[0] === '.' ? domain : '.' + domain);
|
||||
this.domainTrie.add(domain, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
bulkAddDomainSuffix(domains: string[]) {
|
||||
|
||||
Reference in New Issue
Block a user