mirror of
https://github.com/iptv-org/iptv
synced 2025-12-17 02:47:33 -05:00
Update scripts
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
export function isURI(string: string): boolean {
|
||||
try {
|
||||
new URL(string)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
import normalizeUrl from 'normalize-url'
|
||||
|
||||
export function isURI(string: string): boolean {
|
||||
try {
|
||||
new URL(string)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export function normalizeURL(url: string): string {
|
||||
const normalized = normalizeUrl(url, { stripWWW: false })
|
||||
|
||||
return decodeURIComponent(normalized).replace(/\s/g, '+').toString()
|
||||
}
|
||||
|
||||
export function truncate(string: string, limit: number = 100) {
|
||||
if (!string) return string
|
||||
if (string.length < limit) return string
|
||||
|
||||
return string.slice(0, limit - 3) + '...'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user