mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Chore: housekeeping
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { createTrie } from './trie';
|
||||
|
||||
export const domainDeduper = (inputDomains: string[]): string[] => {
|
||||
export function domainDeduper(inputDomains: string[], toArray?: true): string[];
|
||||
export function domainDeduper(inputDomains: string[], toArray: false): Set<string>;
|
||||
export function domainDeduper(inputDomains: string[], toArray = true): string[] | Set<string> {
|
||||
const trie = createTrie(inputDomains);
|
||||
const sets = new Set(inputDomains);
|
||||
|
||||
@@ -19,7 +21,11 @@ export const domainDeduper = (inputDomains: string[]): string[] => {
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(sets);
|
||||
};
|
||||
if (toArray) {
|
||||
return Array.from(sets);
|
||||
}
|
||||
|
||||
return sets;
|
||||
}
|
||||
|
||||
export default domainDeduper;
|
||||
|
||||
Reference in New Issue
Block a user