@ancon/wildcat-utils 1.52.2 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.52.2",
3
+ "version": "1.52.4",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "types": "index.d.ts",
@@ -1 +1,6 @@
1
- export default function base64Encode(str: string): string;
1
+ declare type Base64EncodeOptions = {
2
+ urlSafe?: boolean;
3
+ padding?: 'omit' | 'encode';
4
+ };
5
+ export default function base64Encode(str: string, options?: Base64EncodeOptions): string;
6
+ export {};
@@ -1 +1 @@
1
- "use strict";function o(n){const t=new TextEncoder().encode(n),e=String.fromCodePoint(...t);return btoa(e)}module.exports=o;
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;
@@ -1,7 +1,9 @@
1
- function o(n) {
2
- const e = new TextEncoder().encode(n), t = String.fromCodePoint(...e);
3
- return btoa(t);
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
- o as default
8
+ g as default
7
9
  };