converter/src/app/converter/punycodeencoder.ts

21 lines
487 B
TypeScript
Raw Normal View History

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