mirror of
https://github.com/movie-web/extension.git
synced 2025-09-13 18:13:25 +00:00
10 lines
232 B
TypeScript
10 lines
232 B
TypeScript
export function makeUrlIntoDomain(url: string): string | null {
|
|
try {
|
|
const u = new URL(url);
|
|
if (!['http:', 'https:'].includes(u.protocol)) return null;
|
|
return u.host.toLowerCase();
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|