iptv/scripts/core/url.ts

21 lines
354 B
TypeScript
Raw Normal View History

2023-09-15 17:40:35 +02:00
import normalizeUrl from 'normalize-url'
export class URL {
url: string
constructor(url: string) {
this.url = url
}
normalize(): URL {
const normalized = normalizeUrl(this.url, { stripWWW: false })
this.url = decodeURIComponent(normalized).replace(/\s/g, '+')
return this
}
toString(): string {
return this.url
}
}