From 2374759195570786df134f6eb8052e9b9878ad9b Mon Sep 17 00:00:00 2001 From: SukkaW Date: Tue, 30 Jun 2026 17:28:01 +0800 Subject: [PATCH] Chore: use `foxts/counter` --- Build/validate-reject-stats.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Build/validate-reject-stats.ts b/Build/validate-reject-stats.ts index 91c51d5c..1e7d9016 100644 --- a/Build/validate-reject-stats.ts +++ b/Build/validate-reject-stats.ts @@ -3,23 +3,19 @@ import { OUTPUT_SURGE_DIR } from './constants/dir'; import tldts from 'tldts-experimental'; import { loosTldOptWithPrivateDomains } from './constants/loose-tldts-opt'; import runAgainstSourceFile from './lib/run-against-source-file'; +import { Counter } from 'foxts/counter'; (async () => { - const rejectDomainCountMap = new Map(); - const rejectExtraDomainCountMap = new Map(); + const rejectDomainCountMap = new Counter(); + const rejectExtraDomainCountMap = new Counter(); - const callback = (map: Map) => (domain: string) => { + const callback = (map: Counter) => (domain: string) => { const apexDomain = tldts.getDomain(domain, loosTldOptWithPrivateDomains); if (!apexDomain) { return; } - map.set( - apexDomain, - map.has(apexDomain) - ? map.get(apexDomain)! + 1 - : 1 - ); + map.incr(apexDomain); }; await runAgainstSourceFile(