mirror of
https://github.com/sern-handler/website
synced 2026-06-27 18:22:22 +00:00
15 lines
204 B
JavaScript
15 lines
204 B
JavaScript
const isValidUrl = (s) => {
|
|
if (typeof s !== "string" || !s) {
|
|
return false;
|
|
}
|
|
try {
|
|
const dummy = new URL(s);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
};
|
|
export {
|
|
isValidUrl
|
|
};
|