Corrected NativeLibraryWrapperService.

This commit is contained in:
Manuel Friedli 2018-08-31 23:00:13 +02:00
parent 82c371956b
commit 9e11ba9335
13 changed files with 46 additions and 26 deletions

View file

@ -3,7 +3,7 @@ import {NgModule} from '@angular/core';
import {AppComponent} from './app.component';
import {ConverterRegistryService} from './converter-registry.service';
import {InputComponentManagerService} from './input-component-manager.service';
import {NativeLibraryWrapperService} from './nativelibrarywrapper.service';
import {NativeLibraryWrapperService} from './native-library-wrapper.service';
import {FormsModule} from '@angular/forms';
import {VersionComponent} from './version/version.component';

View file

@ -8,7 +8,7 @@ import {HexToDecConverter} from './converter/hextodecconverter';
import {HTMLEntitiesDecoder} from './converter/htmlentitiesdecoder';
import {HTMLEntitiesEncoder} from './converter/htmlentitiesencoder';
import {Injectable} from '@angular/core';
import {NativeLibraryWrapperService} from './nativelibrarywrapper.service';
import {NativeLibraryWrapperService} from './native-library-wrapper.service';
import {PunycodeDecoder} from './converter/punycodedecoder';
import {PunycodeEncoder} from './converter/punycodeencoder';
import {QuotedPrintableDecoder} from './converter/quotedprintabledecoder';

View file

@ -1,5 +1,5 @@
import {Converter} from './converter';
import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service';
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
export class PunycodeDecoder implements Converter {

View file

@ -1,5 +1,5 @@
import {Converter} from './converter';
import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service';
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
export class PunycodeEncoder implements Converter {

View file

@ -1,5 +1,5 @@
import {Converter} from './converter';
import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service';
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
export class QuotedPrintableDecoder implements Converter {

View file

@ -1,5 +1,5 @@
import {Converter} from './converter';
import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service';
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
export class QuotedPrintableEncoder implements Converter {

View file

@ -1,5 +1,5 @@
import {Converter} from './converter';
import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service';
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
export class UTF8Decoder implements Converter {

View file

@ -1,5 +1,5 @@
import {Converter} from './converter';
import {NativeLibraryWrapperService} from '../nativelibrarywrapper.service';
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
export class UTF8Encoder implements Converter {

View file

@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { NativeLibraryWrapperService } from './native-library-wrapper.service';
describe('NativeLibraryWrapperService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [NativeLibraryWrapperService]
});
});
it('should be created', inject([NativeLibraryWrapperService], (service: NativeLibraryWrapperService) => {
expect(service).toBeTruthy();
}));
});

View file

@ -1,12 +1,11 @@
import {Injectable} from '@angular/core';
import {Punycode} from './punycode';
import {Utf8} from './utf8';
import {QuotedPrintable} from './quotedprintable';
import * as NativeUtf8 from 'utf8';
import * as NativeQuotedPrintable from 'quoted-printable';
import * as NativePunycode from 'punycode';
import * as NativeQuotedPrintable from 'quoted-printable';
import * as NativeUtf8 from 'utf8';
@Injectable()
@Injectable({
providedIn: 'root'
})
export class NativeLibraryWrapperService {
public utf8: Utf8;
public quotedPrintable: QuotedPrintable;
@ -18,3 +17,21 @@ export class NativeLibraryWrapperService {
this.punycode = NativePunycode;
}
}
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;
}

View file

@ -1,4 +0,0 @@
export interface Punycode {
encode(input: string): string;
decode(input: string): string;
}

View file

@ -1,4 +0,0 @@
export interface QuotedPrintable {
encode(input: string): string;
decode(input: string): string;
}

View file

@ -1,4 +0,0 @@
export interface Utf8 {
encode(input: any): string;
decode(input: string): any;
}