mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Change base64 functions to be exported not as object children (#4298)
This commit is contained in:
parent
e5bf5920fc
commit
18d695348b
@ -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);
|
||||
}
|
||||
|
||||
@ -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,
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user