Select Git revision
parseUrl.ts
parseUrl.ts 244 B
export function parseUrl(url: string | null | undefined): URL | null {
if (url === null || url === undefined || url === "") {
return null;
}
try {
return new URL(url);
} catch (_) {
return null;
}
}