xshell 1.3.63 → 1.3.64

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": "xshell",
3
- "version": "1.3.63",
3
+ "version": "1.3.64",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -39,4 +39,27 @@ if (!Object.groupBy)
39
39
  return result;
40
40
  }, {});
41
41
  });
42
+ if (!Uint8Array.prototype.toBase64)
43
+ define(Uint8Array.prototype, 'toBase64', function toBase64(options) {
44
+ let binary = '';
45
+ for (let i = 0; i < this.length; i++)
46
+ Array.from(this)
47
+ .map(c => String.fromCharCode(c))
48
+ .join('');
49
+ let base64 = btoa(binary);
50
+ if (options?.alphabet === 'base64url')
51
+ base64 = base64.replaceAll('+', '-').replaceAll('/', '_').replace(/=+$/, '');
52
+ return base64;
53
+ });
54
+ if (!Uint8Array.fromBase64)
55
+ define(Uint8Array, 'fromBase64', function fromBase64(base64, options) {
56
+ let str = base64;
57
+ if (options?.alphabet === 'base64url')
58
+ str = str.replaceAll('-', '+').replaceAll('_', '/');
59
+ const binary = atob(str); // 如果非法输入,让 DOMException 直接抛出(可用于 "strict" 模式)
60
+ const bytes = new Uint8Array(binary.length);
61
+ for (let i = 0; i < binary.length; i++)
62
+ bytes[i] = binary.charCodeAt(i);
63
+ return bytes;
64
+ });
42
65
  //# sourceMappingURL=polyfill.browser.js.map