2017-04-15 19:04:49 +02:00
|
|
|
import {Injectable} from '@angular/core';
|
|
|
|
import * as NativePunycode from 'punycode';
|
2018-08-31 23:00:13 +02:00
|
|
|
import * as NativeQuotedPrintable from 'quoted-printable';
|
|
|
|
import * as NativeUtf8 from 'utf8';
|
2016-09-20 22:34:31 +02:00
|
|
|
|
2018-08-31 23:00:13 +02:00
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
})
|
2016-09-20 22:34:31 +02:00
|
|
|
export class NativeLibraryWrapperService {
|
2017-04-08 00:24:44 +02:00
|
|
|
public utf8: Utf8;
|
|
|
|
public quotedPrintable: QuotedPrintable;
|
|
|
|
public punycode: Punycode;
|
2016-09-20 22:34:31 +02:00
|
|
|
|
2017-04-08 00:24:44 +02:00
|
|
|
constructor() {
|
|
|
|
this.utf8 = NativeUtf8;
|
|
|
|
this.quotedPrintable = NativeQuotedPrintable;
|
|
|
|
this.punycode = NativePunycode;
|
|
|
|
}
|
2016-09-27 23:50:52 +02:00
|
|
|
}
|
2018-08-31 23:00:13 +02:00
|
|
|
|
|
|
|
interface Punycode {
|
|
|
|
encode(input: string): string;
|
|
|
|
|
|
|
|
decode(input: string): string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface QuotedPrintable {
|
|
|
|
encode(input: string): string;
|
|
|
|
|
|
|
|
decode(input: string): string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Utf8 {
|
|
|
|
encode(input: any): string;
|
|
|
|
|
|
|
|
decode(input: string): any;
|
|
|
|
}
|