summaryrefslogtreecommitdiff
path: root/packages/integrations/sitemap/src/utils/is-valid-url.ts
blob: b140623b090f4dc751549530e16879d21f46d4d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// @internal
export const isValidUrl = (s: any) => {
	if (typeof s !== 'string' || !s) {
		return false;
	}
	try {
		// eslint-disable-next-line @typescript-eslint/no-unused-vars
		const dummy = new URL(s);
		return true;
	} catch {
		return false;
	}
};