Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

url.ts

8 lines248 Bytes

1// `URL.parse` and `URL.canParse` are missing before Safari 17/18, and client code ships unpolyfilled.
2export function parseUrl(value: string, base?: string): URL | null {
3 try {
4 return new URL(value, base);
5 } catch {
6 return null;
7 }
8}