js-base64 3.9.3 → 3.9.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/README.md CHANGED
@@ -26,7 +26,7 @@ Locally…
26
26
  … or Directly from CDN. In which case you don't even need to install.
27
27
 
28
28
  ```html
29
- <script src="https://cdn.jsdelivr.net/npm/js-base64@3.9.3/base64.min.js"></script>
29
+ <script src="https://cdn.jsdelivr.net/npm/js-base64@3.9.4/base64.min.js"></script>
30
30
  ```
31
31
 
32
32
  This good old way loads `Base64` in the global context (`window`). Though `Base64.noConflict()` is made available, you should consider using ES6 Module to avoid tainting `window`.
@@ -49,14 +49,14 @@ or even remotely.
49
49
  ```html
50
50
  <script type="module">
51
51
  // note jsdelivr.net does not automatically minify .mjs
52
- import { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.9.3/base64.mjs';
52
+ import { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.9.4/base64.mjs';
53
53
  </script>
54
54
  ```
55
55
 
56
56
  ```html
57
57
  <script type="module">
58
58
  // or if you prefer no Base64 namespace
59
- import { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.9.3/base64.mjs';
59
+ import { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.9.4/base64.mjs';
60
60
  </script>
61
61
  ```
62
62
 
package/base64.d.mts CHANGED
@@ -63,10 +63,11 @@ declare const atobPolyfill: (asc: string) => string;
63
63
  * @returns {string} binary string
64
64
  */
65
65
  declare const _atob: (asc: string) => string;
66
+ type Uint8ArrayBuffer = ReturnType<Uint8Array['slice']>;
66
67
  /**
67
68
  * converts a Base64 string to a Uint8Array.
68
69
  */
69
- declare const toUint8Array: (a: string) => Uint8Array;
70
+ declare const toUint8Array: (a: string) => Uint8ArrayBuffer;
70
71
  /**
71
72
  * converts a Base64 string to a UTF-8 string.
72
73
  * @param {String} src Base64 string. Both normal and URL-safe are supported
@@ -107,7 +108,7 @@ declare const gBase64: {
107
108
  decode: (src: string) => string;
108
109
  isValid: (src: unknown) => boolean;
109
110
  fromUint8Array: (u8a: Uint8Array, urlsafe?: boolean) => string;
110
- toUint8Array: (a: string) => Uint8Array;
111
+ toUint8Array: (a: string) => Uint8ArrayBuffer;
111
112
  extendString: () => void;
112
113
  extendUint8Array: () => void;
113
114
  extendBuiltins: () => void;
package/base64.d.ts CHANGED
@@ -63,10 +63,11 @@ declare const atobPolyfill: (asc: string) => string;
63
63
  * @returns {string} binary string
64
64
  */
65
65
  declare const _atob: (asc: string) => string;
66
+ type Uint8ArrayBuffer = ReturnType<Uint8Array['slice']>;
66
67
  /**
67
68
  * converts a Base64 string to a Uint8Array.
68
69
  */
69
- declare const toUint8Array: (a: string) => Uint8Array;
70
+ declare const toUint8Array: (a: string) => Uint8ArrayBuffer;
70
71
  /**
71
72
  * converts a Base64 string to a UTF-8 string.
72
73
  * @param {String} src Base64 string. Both normal and URL-safe are supported
@@ -107,7 +108,7 @@ declare const gBase64: {
107
108
  decode: (src: string) => string;
108
109
  isValid: (src: unknown) => boolean;
109
110
  fromUint8Array: (u8a: Uint8Array, urlsafe?: boolean) => string;
110
- toUint8Array: (a: string) => Uint8Array;
111
+ toUint8Array: (a: string) => Uint8ArrayBuffer;
111
112
  extendString: () => void;
112
113
  extendUint8Array: () => void;
113
114
  extendBuiltins: () => void;
package/base64.js CHANGED
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * @author Dan Kogai (https://github.com/dankogai)
25
25
  */
26
- var version = '3.9.3';
26
+ var version = '3.9.4';
27
27
  /**
28
28
  * @deprecated use lowercase `version`.
29
29
  */
package/base64.mjs CHANGED
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @author Dan Kogai (https://github.com/dankogai)
11
11
  */
12
- const version = '3.9.3';
12
+ const version = '3.9.4';
13
13
  /**
14
14
  * @deprecated use lowercase `version`.
15
15
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-base64",
3
- "version": "3.9.3",
3
+ "version": "3.9.4",
4
4
  "description": "Yet another Base64 transcoder in pure-JS",
5
5
  "main": "base64.js",
6
6
  "module": "base64.mjs",
@@ -28,7 +28,8 @@
28
28
  "scripts": {
29
29
  "build": "rollup -c && tsc -p . --declaration --emitDeclarationOnly && node -e \"require('fs').copyFileSync('base64.d.ts','base64.d.mts')\"",
30
30
  "clean": "node -e \"['base64.js','base64.mjs','base64.d.ts','base64.d.mts'].forEach(f=>require('fs').rmSync(f,{force:true}))\"",
31
- "test": "npm run build && mocha",
31
+ "test": "npm run build && mocha && npm run test:types",
32
+ "test:types": "tsc --noEmit --strict --module nodenext --lib es2020,dom test/types.cts test/types.mts",
32
33
  "version": "npm run build && node util/sync-version.js && git add base64.js base64.mjs base64.d.ts base64.d.mts README.md"
33
34
  },
34
35
  "devDependencies": {