Minor changes here and there

This commit is contained in:
SukkaW 2024-09-20 16:10:19 +08:00
parent bdc3955ac6
commit 5c8636d7b3
2 changed files with 10 additions and 6 deletions

View File

@ -28,8 +28,8 @@ export const buildParseDomainMap = (inputs: string[]) => {
export const sortDomains = (
inputs: string[],
domainMap?: Map<string, string>,
subdomainMap?: Map<string, string>
domainMap?: Map<string, string> | null,
subdomainMap?: Map<string, string> | null
) => {
if (!domainMap || !subdomainMap) {
const { domainMap: dm, subdomainMap: sm } = buildParseDomainMap(inputs);

View File

@ -369,12 +369,16 @@ export const createTrie = <Meta = any>(from?: string[] | Set<string> | null, smo
: false;
};
const dump = () => {
function dump(onSuffix: (suffix: string) => void): void;
function dump(): string[];
function dump(onSuffix?: (suffix: string) => void): string[] | void {
const results: string[] = [];
walk(suffix => {
results.push(fastStringArrayJoin(suffix, ''));
});
const handleSuffix = onSuffix
? (suffix: string[]) => onSuffix(fastStringArrayJoin(suffix, ''))
: (suffix: string[]) => results.push(fastStringArrayJoin(suffix, ''));
walk(handleSuffix);
return results;
};