mirror of https://github.com/iptv-org/iptv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
354 B
TypeScript
21 lines
354 B
TypeScript
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
|
|
}
|
|
}
|