@ancon/wildcat-utils 1.52.3 → 1.52.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/string/base64Encode.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
declare type Base64EncodeOptions = {
|
|
2
|
+
urlSafe?: boolean;
|
|
3
|
+
padding?: 'omit' | 'encode';
|
|
4
|
+
};
|
|
5
|
+
export default function base64Encode(str: string, options?: Base64EncodeOptions): string;
|
|
6
|
+
export {};
|
package/string/base64Encode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function f(t,r){const a=new TextEncoder().encode(t),n=String.fromCodePoint(...a);let e=btoa(n);const d=(r==null?void 0:r.urlSafe)===!0,c=(r==null?void 0:r.padding)??"omit";return d&&(e=e.replace(/\+/g,"-").replace(/\//g,"_"),c==="omit"&&(e=e.replace(/=+$/,"")),c==="encode"&&(e=e.replace(/=+$/,l=>"%3D".repeat(l.length)))),e}module.exports=f;
|
package/string/base64Encode.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
function c
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
function g(c, r) {
|
|
2
|
+
const t = new TextEncoder().encode(c), n = String.fromCodePoint(...t);
|
|
3
|
+
let e = btoa(n);
|
|
4
|
+
const d = (r == null ? void 0 : r.urlSafe) === !0, a = (r == null ? void 0 : r.padding) ?? "omit";
|
|
5
|
+
return d && (e = e.replace(/\+/g, "-").replace(/\//g, "_"), a === "omit" && (e = e.replace(/=+$/, "")), a === "encode" && (e = e.replace(/=+$/, (l) => "%3D".repeat(l.length)))), e;
|
|
4
6
|
}
|
|
5
7
|
export {
|
|
6
|
-
|
|
8
|
+
g as default
|
|
7
9
|
};
|