[SDK] Address stack review feedback (#11389)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-13 22:26:23 +03:00
committed by GitHub
parent 3677c98873
commit b89167f07c
8 changed files with 69 additions and 22 deletions
+9
View File
@@ -27,6 +27,15 @@ const TRUSTED_REGEX = new RegExp(
)})|/|#)`,
)
export function canParseUrl(url: string | URL, base?: string | URL): boolean {
try {
new URL(url, base)
return true
} catch {
return false
}
}
export function isValidDomain(str: string): boolean {
return !!TLDs.find(tld => {
let i = str.lastIndexOf(tld)