export default class OAURL { private isDigitTld : boolean ; private url : URL ; constructor ( url ) { this . isDigitTld = url . includes ( '.888' ) ; this . url = this . isDigitTld ? new URL ( this . fromDot888ToDotCom ( url ) ) : new URL ( url ) ; } hostname ( ) { return this . isDigitTld ? this . fromDotComToDot888 ( this . url . hostname ) : this . url . hostname ; } protocol ( ) { return this . url . protocol ; } pathname ( ) { return this . isDigitTld ? this . fromDotComToDot888 ( this . url . pathname ) : this . url . pathname ; } searchParams ( ) { return this . url . searchParams ; } toString ( ) { return this . isDigitTld ? this . fromDotComToDot888 ( this . url . toString ( ) ) : this . url . toString ( ) ; } private fromDotComToDot888 ( mes ) { return mes . replace ( '.com' , '.888' ) ; } private fromDot888ToDotCom ( mes ) { return mes . replace ( '.888' , '.com' ) ; } }