Update CDN & Reject Hosts

This commit is contained in:
SukkaW
2024-02-06 14:25:03 +08:00
parent 880715f196
commit aca48afb6d
3 changed files with 47 additions and 11 deletions

View File

@@ -22,10 +22,14 @@ const deepTrieNodeToJSON = (node: TrieNode) => {
return obj;
};
function trieNodeInspectCustom(this: TrieNode) {
return JSON.stringify(deepTrieNodeToJSON(this), null, 2);
}
const createNode = (): TrieNode => {
const node = new Map<string, TrieNode>() as TrieNode;
node[SENTINEL] = false;
node[Bun.inspect.custom] = () => JSON.stringify(deepTrieNodeToJSON(node), null, 2);
node[Bun.inspect.custom] = trieNodeInspectCustom;
return node;
};
@@ -70,9 +74,7 @@ export const createTrie = (from?: string[] | Set<string> | null) => {
token = suffix[i];
node = node.get(token);
if (!node) {
return false;
}
if (!node) return false;
}
return true;
@@ -88,9 +90,7 @@ export const createTrie = (from?: string[] | Set<string> | null) => {
token = inputSuffix[i];
node = node.get(token);
if (!node) {
return [];
}
if (!node) return [];
}
const matches: string[] = [];
@@ -130,9 +130,7 @@ export const createTrie = (from?: string[] | Set<string> | null) => {
token = inputSuffix[i];
node = node.get(token);
if (!node) {
return;
}
if (!node) return;
}
// Performing DFS from prefix