Chore: print gfwlist validation count

This commit is contained in:
SukkaW
2025-11-19 23:20:50 +08:00
parent c12add3a8b
commit b388936bf3
3 changed files with 19 additions and 8 deletions

View File

@@ -23,10 +23,11 @@ type TrieNode<Meta = any> = [
function deepTrieNodeToJSON<Meta = unknown>(node: TrieNode,
unpackMeta: ((meta?: Meta) => string) | undefined) {
const obj: Record<string, unknown> = {};
const obj: Record<string, unknown> = {
['[start]']: getBit(node[0], START),
['[subdomain]']: getBit(node[0], INCLUDE_ALL_SUBDOMAIN)
};
obj['[start]'] = getBit(node[0], START);
obj['[subdomain]'] = getBit(node[0], INCLUDE_ALL_SUBDOMAIN);
if (node[4] != null) {
if (unpackMeta) {
obj['[meta]'] = unpackMeta(node[4]);
@@ -278,12 +279,10 @@ abstract class Triebase<Meta = unknown> {
) {
const dfsImpl = withSort ? Triebase.dfsWithSort : Triebase.dfs;
const nodeStack: Array<TrieNode<Meta>> = [];
nodeStack.push(initialNode);
const nodeStack: Array<TrieNode<Meta>> = [initialNode];
// Resolving initial string (begin the start of the stack)
const suffixStack: string[][] = [];
suffixStack.push(initialSuffix);
const suffixStack: string[][] = [initialSuffix];
let node: TrieNode<Meta> = initialNode;
let r;