Change base64 functions to be exported not as object children (#4298)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-11-09 13:43:45 -05:00
1 parent e5bf5920fc
commit 18d695348b
2 files changed
+19 -9

No files matched your search

+17 -8
View File
@@ -23,11 +23,20 @@
import * as Base64 from "crypto-js/enc-base64";
import * as Utf8 from "crypto-js/enc-utf8";
export const base64 = {
decode(data: string) {
return Base64.parse(data).toString(Utf8);
},
encode(data: string) {
return Utf8.parse(data).toString(Base64);
},
};
/**
* Computes utf-8 from base64
* @param data A Base64 encoded string
* @returns The original utf-8 string
*/
export function decode(data: string): string {
return Base64.parse(data).toString(Utf8);
}
/**
* Computes base64 from utf-8
* @param data A normal string
* @returns A base64 encoded version
*/
export function encode(data: string): string {
return Utf8.parse(data).toString(Base64);
}
+2 -1
View File
@@ -28,7 +28,6 @@ export function noop<T extends any[]>(...args: T): void {
export * from "./app-version";
export * from "./autobind";
export * from "./base64";
export * from "./camelCase";
export * from "./cloneJson";
export * from "./cluster-id-url-parsing";
@@ -62,9 +61,11 @@ export * from "./types";
import * as iter from "./iter";
import * as array from "./array";
import * as tuple from "./tuple";
import * as base64 from "./base64";
export {
iter,
array,
tuple,
base64,
};