Merge branch 'feature/punycodeconversion' into 'develop'
Feature/punycodeconversion See merge request !9
This commit is contained in:
commit
242d733b01
8 changed files with 55 additions and 2 deletions
|
@ -36,6 +36,7 @@ build_job:
|
|||
- node_modules/systemjs/dist/system.src.js
|
||||
- node_modules/utf8/utf8.js
|
||||
- node_modules/quoted-printable/quoted-printable.js
|
||||
- node_modules/punycode/punycode.js
|
||||
- abeezee-regular.woff
|
||||
- freemono.eot
|
||||
- freemono.svg
|
||||
|
|
20
app/converter/punycodedecoder.ts
Normal file
20
app/converter/punycodedecoder.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import {Converter} from "./converter";
|
||||
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
|
||||
|
||||
export class PunycodeDecoder implements Converter {
|
||||
|
||||
constructor(private nativeLibraryWrapperService: NativeLibraryWrapperService) {
|
||||
}
|
||||
|
||||
getDisplayname(): string {
|
||||
return "Decode from punycode";
|
||||
}
|
||||
|
||||
getId(): string {
|
||||
return "decodepunycode";
|
||||
}
|
||||
|
||||
convert(input: string): string {
|
||||
return this.nativeLibraryWrapperService.punycode.decode(input);
|
||||
}
|
||||
}
|
20
app/converter/punycodeencoder.ts
Normal file
20
app/converter/punycodeencoder.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import {Converter} from "./converter";
|
||||
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
|
||||
|
||||
export class PunycodeEncoder implements Converter {
|
||||
|
||||
constructor(private nativeLibraryWrapperService: NativeLibraryWrapperService) {
|
||||
}
|
||||
|
||||
getDisplayname(): string {
|
||||
return "Encode as punycode";
|
||||
}
|
||||
|
||||
getId(): string {
|
||||
return "encodepunycode";
|
||||
}
|
||||
|
||||
convert(input: string): string {
|
||||
return this.nativeLibraryWrapperService.punycode.encode(input);
|
||||
}
|
||||
}
|
|
@ -15,6 +15,8 @@ import {BinToDecConverter} from "./converter/bintodecconverter";
|
|||
import {QuotedPrintableDecoder} from "./converter/quotedprintabledecoder";
|
||||
import {QuotedPrintableEncoder} from "./converter/quotedprintableencoder";
|
||||
import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service";
|
||||
import {PunycodeEncoder} from "./converter/punycodeencoder";
|
||||
import {PunycodeDecoder} from "./converter/punycodedecoder";
|
||||
|
||||
@Injectable()
|
||||
export class ConverterRegistryService {
|
||||
|
@ -52,6 +54,8 @@ export class ConverterRegistryService {
|
|||
this.registerConverter(new HexToDecConverter());
|
||||
this.registerConverter(new DecToBinConverter());
|
||||
this.registerConverter(new BinToDecConverter());
|
||||
this.registerConverter(new PunycodeEncoder(this.wrapper));
|
||||
this.registerConverter(new PunycodeDecoder(this.wrapper));
|
||||
}
|
||||
|
||||
private registerConverter(converter:Converter):void {
|
||||
|
|
|
@ -2,14 +2,17 @@ import {Injectable} from "@angular/core";
|
|||
|
||||
declare var utf8:any;
|
||||
declare var quotedPrintable:any;
|
||||
declare var punycode:any;
|
||||
|
||||
@Injectable()
|
||||
export class NativeLibraryWrapperService {
|
||||
public utf8:any;
|
||||
public quotedPrintable:any;
|
||||
public punycode:any;
|
||||
|
||||
constructor() {
|
||||
this.utf8 = utf8;
|
||||
this.quotedPrintable = quotedPrintable;
|
||||
this.punycode = punycode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,7 @@ cp -a node_modules/utf8/utf8.js "${destination}/node_modules/utf8/" || die "Fail
|
|||
mkdir -p "${destination}/node_modules/quoted-printable" || die "Failed to create dest/node_modules/quoted-printable"
|
||||
cp -a node_modules/quoted-printable/quoted-printable.js "${destination}/node_modules/quoted-printable/" || die "Failed to copy quoted-printable.js"
|
||||
|
||||
mkdir -p "${destination}/node_modules/punycode" || die "Failed to create dest/node_modules/punycode"
|
||||
cp -a node_modules/punycode/punycode.js "${destination}/node_modules/punycode/" || die "Failed to copy punycode.js"
|
||||
|
||||
echo "Deployment successful."
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<script type="text/javascript" src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
<script type="text/javascript" src="node_modules/utf8/utf8.js"></script>
|
||||
<script type="text/javascript" src="node_modules/quoted-printable/quoted-printable.js"></script>
|
||||
<script type="text/javascript" src="node_modules/punycode/punycode.js"></script>
|
||||
|
||||
<script type="text/javascript" src="systemjs.config.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
"systemjs": "^0.19.27",
|
||||
"zone.js": "^0.6.12",
|
||||
"quoted-printable": "^1.0.0",
|
||||
"utf8": "^2.1.1"
|
||||
"utf8": "^2.1.1",
|
||||
"punycode": "1.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "^2.2.0",
|
||||
|
|
Loading…
Reference in a new issue