Refactor isLocalhost function for readability

ALso to fix lint error
This commit is contained in:
Sicarius
2026-03-02 11:03:15 -06:00
committed by GitHub
parent c890351029
commit 49eae4e8ab

View File

@@ -4,7 +4,10 @@ const DANGEROUS_SCHEMES = ["javascript:", "data:", "vbscript:"];
function isLocalhost(hostname: string): boolean {
return (
hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]" || hostname.endsWith(".localhost")
hostname === "localhost"
|| hostname === "127.0.0.1"
|| hostname === "[::1]"
|| hostname.endsWith(".localhost")
);
}