expose base64 functions seperate from class
This commit is contained in:
parent
39ce541532
commit
1684eae1e8
5
dist/smartstring.base64.d.ts
vendored
5
dist/smartstring.base64.d.ts
vendored
@ -21,3 +21,8 @@ export declare class Base64 {
|
|||||||
*/
|
*/
|
||||||
readonly base64StringUri: any;
|
readonly base64StringUri: any;
|
||||||
}
|
}
|
||||||
|
export declare let base64: {
|
||||||
|
encode: (stringArg: string) => any;
|
||||||
|
encodeUri: (stringArg: string) => any;
|
||||||
|
decode: (stringArg: string) => any;
|
||||||
|
};
|
||||||
|
30
dist/smartstring.base64.js
vendored
30
dist/smartstring.base64.js
vendored
@ -10,10 +10,10 @@ class Base64 {
|
|||||||
this.refString = inputStringArg;
|
this.refString = inputStringArg;
|
||||||
break;
|
break;
|
||||||
case 'base64':
|
case 'base64':
|
||||||
this.refString = plugins.jsBase64.decode(inputStringArg);
|
this.refString = exports.base64.decode(inputStringArg);
|
||||||
break;
|
break;
|
||||||
case 'base64uri':
|
case 'base64uri':
|
||||||
this.refString = plugins.jsBase64.decode(inputStringArg);
|
this.refString = exports.base64.decode(inputStringArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -26,14 +26,34 @@ class Base64 {
|
|||||||
* the base64 encoded version of the original string
|
* the base64 encoded version of the original string
|
||||||
*/
|
*/
|
||||||
get base64String() {
|
get base64String() {
|
||||||
return plugins.jsBase64.encode(this.refString);
|
return exports.base64.encode(this.refString);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* the base64uri encoded version of the original string
|
* the base64uri encoded version of the original string
|
||||||
*/
|
*/
|
||||||
get base64StringUri() {
|
get base64StringUri() {
|
||||||
return plugins.jsBase64.encodeURI(this.refString);
|
return exports.base64.encodeUri(this.refString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Base64 = Base64;
|
exports.Base64 = Base64;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJp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ifQ==
|
exports.base64 = {
|
||||||
|
/**
|
||||||
|
* encodes the string
|
||||||
|
*/
|
||||||
|
encode: (stringArg) => {
|
||||||
|
return plugins.jsBase64.encode(stringArg);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* encodes a stringArg to base64 uri style
|
||||||
|
*/
|
||||||
|
encodeUri: (stringArg) => {
|
||||||
|
return plugins.jsBase64.encodeURI(stringArg);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* decodes a base64 encoded string
|
||||||
|
*/
|
||||||
|
decode: (stringArg) => {
|
||||||
|
return plugins.jsBase64.decode(stringArg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuYmFzZTY0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuYmFzZTY0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxpREFBZ0Q7QUFPaEQ7O0dBRUc7QUFDSDtJQUVJLFlBQVksY0FBYyxFQUFFLE9BQXFCO1FBQzdDLE1BQU0sQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7WUFDZCxLQUFLLFFBQVE7Z0JBQ1QsSUFBSSxDQUFDLFNBQVMsR0FBRyxjQUFjLENBQUE7Z0JBQy9CLEtBQUssQ0FBQTtZQUNULEtBQUssUUFBUTtnQkFDVCxJQUFJLENBQUMsU0FBUyxHQUFHLGNBQU0sQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUE7Z0JBQzlDLEtBQUssQ0FBQTtZQUNULEtBQUssV0FBVztnQkFDWixJQUFJLENBQUMsU0FBUyxHQUFHLGNBQU0sQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUE7UUFDdEQsQ0FBQztJQUNMLENBQUM7SUFFRDs7T0FFRztJQUNILElBQUksWUFBWTtRQUNaLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFBO0lBQ3pCLENBQUM7SUFFRDs7T0FFRztJQUNILElBQUksWUFBWTtRQUNaLE1BQU0sQ0FBQyxjQUFNLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUN4QyxDQUFDO0lBRUQ7O09BRUc7SUFDSCxJQUFJLGVBQWU7UUFDZixNQUFNLENBQUMsY0FBTSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDM0MsQ0FBQztDQUNKO0FBbkNELHdCQW1DQztBQUVVLFFBQUEsTUFBTSxHQUFHO0lBQ2hCOztPQUVHO0lBQ0gsTUFBTSxFQUFFLENBQUMsU0FBaUI7UUFDdEIsTUFBTSxDQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQzdDLENBQUM7SUFFRDs7T0FFRztJQUNILFNBQVMsRUFBRSxDQUFDLFNBQWlCO1FBQ3pCLE1BQU0sQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUNoRCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxNQUFNLEVBQUUsQ0FBQyxTQUFpQjtRQUN0QixNQUFNLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDN0MsQ0FBQztDQUNKLENBQUEifQ==
|
@ -16,10 +16,10 @@ export class Base64 {
|
|||||||
this.refString = inputStringArg
|
this.refString = inputStringArg
|
||||||
break
|
break
|
||||||
case 'base64':
|
case 'base64':
|
||||||
this.refString = plugins.jsBase64.decode(inputStringArg)
|
this.refString = base64.decode(inputStringArg)
|
||||||
break
|
break
|
||||||
case 'base64uri':
|
case 'base64uri':
|
||||||
this.refString = plugins.jsBase64.decode(inputStringArg)
|
this.refString = base64.decode(inputStringArg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,13 +34,36 @@ export class Base64 {
|
|||||||
* the base64 encoded version of the original string
|
* the base64 encoded version of the original string
|
||||||
*/
|
*/
|
||||||
get base64String() {
|
get base64String() {
|
||||||
return plugins.jsBase64.encode(this.refString)
|
return base64.encode(this.refString)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the base64uri encoded version of the original string
|
* the base64uri encoded version of the original string
|
||||||
*/
|
*/
|
||||||
get base64StringUri() {
|
get base64StringUri() {
|
||||||
return plugins.jsBase64.encodeURI(this.refString)
|
return base64.encodeUri(this.refString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export let base64 = {
|
||||||
|
/**
|
||||||
|
* encodes the string
|
||||||
|
*/
|
||||||
|
encode: (stringArg: string) => {
|
||||||
|
return plugins.jsBase64.encode(stringArg)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* encodes a stringArg to base64 uri style
|
||||||
|
*/
|
||||||
|
encodeUri: (stringArg: string) => {
|
||||||
|
return plugins.jsBase64.encodeURI(stringArg)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* decodes a base64 encoded string
|
||||||
|
*/
|
||||||
|
decode: (stringArg: string) => {
|
||||||
|
return plugins.jsBase64.decode(stringArg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user