2017-04-15 19:04:49 +02:00
|
|
|
import {Converter} from './converter';
|
2018-08-31 23:00:13 +02:00
|
|
|
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
2016-09-27 23:50:52 +02:00
|
|
|
|
|
|
|
export class PunycodeEncoder implements Converter {
|
|
|
|
|
2017-04-15 18:51:22 +02:00
|
|
|
constructor(private nativeLibraryWrapperService: NativeLibraryWrapperService) {
|
|
|
|
}
|
2016-09-27 23:50:52 +02:00
|
|
|
|
2017-04-15 18:51:22 +02:00
|
|
|
getDisplayname(): string {
|
2017-04-15 19:04:49 +02:00
|
|
|
return 'Encode as punycode';
|
2017-04-15 18:51:22 +02:00
|
|
|
}
|
2016-09-27 23:50:52 +02:00
|
|
|
|
2017-04-15 18:51:22 +02:00
|
|
|
getId(): string {
|
2017-04-15 19:04:49 +02:00
|
|
|
return 'encodepunycode';
|
2017-04-15 18:51:22 +02:00
|
|
|
}
|
2016-09-27 23:50:52 +02:00
|
|
|
|
2017-04-15 18:51:22 +02:00
|
|
|
convert(input: string): string {
|
|
|
|
return this.nativeLibraryWrapperService.punycode.encode(input);
|
|
|
|
}
|
2016-09-27 23:50:52 +02:00
|
|
|
}
|