import {Converter} from './converter'; export class Base64Encoder implements Converter { getDisplayname(): string { return 'Encode Base 64'; } getId(): string { return 'base64encode'; } convert(input: string): string { try { return btoa(input); } catch (exception) { console.error(exception); throw new Error('Ouch! Looks like you\'ve got a UTF-8 character there. Too bad, this is not supported yet. ' + 'We\'re working on it and hope to be ready soon! Why don\'t you ' + 'enjoy some kittens meanwhile?'); } } }