MCPcopy
hub / github.com/iptv-org/iptv / isURI

Function isURI

scripts/utils.ts:18–25  ·  view source on GitHub ↗
(string: string)

Source from the content-addressed store, hash-verified

16import fs from 'node:fs'
17
18export function isURI(string: string): boolean {
19 try {
20 const url = new URL(string)
21 return /^(http:|https:|mms:|mmsh:|rtsp:|rtmp:|srt:|rtp:|udp:)/.test(url.protocol)
22 } catch {
23 return false
24 }
25}
26
27export function normalizeURL(url: string): string {
28 const normalized = normalizeUrl(url, { stripWWW: false })

Callers 3

mainFunction · 0.90
validateMethod · 0.90
mainFunction · 0.85

Calls 1

testMethod · 0.80

Tested by

no test coverage detected