@frsource/base64 1.0.77 → 1.0.78

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/dist/index.d.ts CHANGED
@@ -1,9 +1,3 @@
1
- /**
2
- *
3
- * Base64 encode / decode
4
- * http://www.webtoolkit.info/
5
- *
6
- **/
7
1
  /**
8
2
  * Encodes given string.
9
3
  *
package/dist/index.js CHANGED
@@ -1,9 +1,3 @@
1
- /**
2
- *
3
- * Base64 encode / decode
4
- * http://www.webtoolkit.info/
5
- *
6
- **/
7
1
  const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
8
2
  /**
9
3
  * Encodes given string.
@@ -48,15 +42,15 @@ const decode = input => {
48
42
  const chr1 = enc1 << 2 | enc2 >> 4;
49
43
  const chr2 = (enc2 & 15) << 4 | enc3 >> 2;
50
44
  const chr3 = (enc3 & 3) << 6 | enc4;
51
- output = output + String.fromCharCode(chr1);
52
- if (enc3 != 64) {
53
- output = output + String.fromCharCode(chr2);
45
+ output += String.fromCharCode(chr1);
46
+ if (enc3 !== 64) {
47
+ output += String.fromCharCode(chr2);
54
48
  }
55
- if (enc4 != 64) {
56
- output = output + String.fromCharCode(chr3);
49
+ if (enc4 !== 64) {
50
+ output += String.fromCharCode(chr3);
57
51
  }
58
52
  }
59
- return output = _utf8_decode(output);
53
+ return _utf8_decode(output);
60
54
  };
61
55
  /**
62
56
  * (private method) does a UTF-8 encoding
@@ -64,20 +58,8 @@ const decode = input => {
64
58
  * @private
65
59
  * @param {string} string - Text to encode
66
60
  */
67
- function _utf8_encode(string) {
68
- string = string.replace(/\r\n/g, '\n');
69
- let utftext = '';
70
- for (let n = 0; n < string.length; n++) {
71
- const c = string.charCodeAt(n);
72
- if (c < 128) {
73
- utftext += String.fromCharCode(c);
74
- } else if (c > 127 && c < 2048) {
75
- utftext += String.fromCharCode(c >> 6 | 192) + String.fromCharCode(c & 63 | 128);
76
- } else {
77
- utftext += String.fromCharCode(c >> 12 | 224) + String.fromCharCode(c >> 6 & 63 | 128) + String.fromCharCode(c & 63 | 128);
78
- }
79
- }
80
- return utftext;
61
+ function _utf8_encode(str) {
62
+ return encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)));
81
63
  }
82
64
  /**
83
65
  * (private method - do not use) does a UTF-8 decoding
@@ -85,26 +67,8 @@ function _utf8_encode(string) {
85
67
  * @private
86
68
  * @param {string} utftext - UTF-8 text to dencode
87
69
  */
88
- function _utf8_decode(utftext) {
89
- let string = '';
90
- let i = 0;
91
- while (i < utftext.length) {
92
- const c = utftext.charCodeAt(i);
93
- if (c < 128) {
94
- string += String.fromCharCode(c);
95
- i++;
96
- } else if (c > 191 && c < 224) {
97
- const c2 = utftext.charCodeAt(i + 1);
98
- string += String.fromCharCode((c & 31) << 6 | c2 & 63);
99
- i += 2;
100
- } else {
101
- const c2 = utftext.charCodeAt(i + 1);
102
- const c3 = utftext.charCodeAt(i + 2);
103
- string += String.fromCharCode((c & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
104
- i += 3;
105
- }
106
- }
107
- return string;
70
+ function _utf8_decode(str) {
71
+ return decodeURIComponent(str.split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join(''));
108
72
  }
109
73
 
110
74
  exports.decode = decode;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../index.ts"],"sourcesContent":["/**\n *\n * Base64 encode / decode\n * http://www.webtoolkit.info/\n *\n **/\n\nconst _keyStr =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes given string.\n *\n * @param {string} input - Text to encode\n */\nexport const encode = (input: string) => {\n let output = '';\n let i = 0;\n\n input = _utf8_encode(input);\n\n while (i < input.length) {\n const chr1 = input.charCodeAt(i++);\n const chr2 = input.charCodeAt(i++);\n const chr3 = input.charCodeAt(i++);\n\n const enc1 = chr1 >> 2;\n const enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n let enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n let enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output =\n output +\n _keyStr.charAt(enc1) +\n _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) +\n _keyStr.charAt(enc4);\n }\n\n return output;\n};\n\n/**\n * Decodes given string.\n *\n * @param {string} input - Text to decode\n */\nexport const decode = (input: string) => {\n let output = '';\n let i = 0;\n\n input = input.replace(/[^A-Za-z0-9+/=]/g, '');\n\n while (i < input.length) {\n const enc1 = _keyStr.indexOf(input.charAt(i++));\n const enc2 = _keyStr.indexOf(input.charAt(i++));\n const enc3 = _keyStr.indexOf(input.charAt(i++));\n const enc4 = _keyStr.indexOf(input.charAt(i++));\n\n const chr1 = (enc1 << 2) | (enc2 >> 4);\n const chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n const chr3 = ((enc3 & 3) << 6) | enc4;\n\n output = output + String.fromCharCode(chr1);\n\n if (enc3 != 64) {\n output = output + String.fromCharCode(chr2);\n }\n\n if (enc4 != 64) {\n output = output + String.fromCharCode(chr3);\n }\n }\n\n return (output = _utf8_decode(output));\n};\n\n/**\n * (private method) does a UTF-8 encoding\n *\n * @private\n * @param {string} string - Text to encode\n */\nfunction _utf8_encode(string: string) {\n string = string.replace(/\\r\\n/g, '\\n');\n let utftext = '';\n\n for (let n = 0; n < string.length; n++) {\n const c = string.charCodeAt(n);\n\n if (c < 128) {\n utftext += String.fromCharCode(c);\n } else if (c > 127 && c < 2048) {\n utftext +=\n String.fromCharCode((c >> 6) | 192) +\n String.fromCharCode((c & 63) | 128);\n } else {\n utftext +=\n String.fromCharCode((c >> 12) | 224) +\n String.fromCharCode(((c >> 6) & 63) | 128) +\n String.fromCharCode((c & 63) | 128);\n }\n }\n\n return utftext;\n}\n\n/**\n * (private method - do not use) does a UTF-8 decoding\n *\n * @private\n * @param {string} utftext - UTF-8 text to dencode\n */\nfunction _utf8_decode(utftext: string) {\n let string = '';\n let i = 0;\n\n while (i < utftext.length) {\n const c = utftext.charCodeAt(i);\n\n if (c < 128) {\n string += String.fromCharCode(c);\n i++;\n } else if (c > 191 && c < 224) {\n const c2 = utftext.charCodeAt(i + 1);\n string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n i += 2;\n } else {\n const c2 = utftext.charCodeAt(i + 1);\n const c3 = utftext.charCodeAt(i + 2);\n string += String.fromCharCode(\n ((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63),\n );\n i += 3;\n }\n }\n return string;\n}\n"],"names":["_keyStr","encode","input","output","i","_utf8_encode","length","chr1","charCodeAt","chr2","chr3","enc1","enc2","enc3","enc4","isNaN","charAt","decode","replace","indexOf","String","fromCharCode","_utf8_decode","string","utftext","n","c","c2","c3"],"mappings":"AAAA;;;;;AAKI;AAEJ,MAAMA,OAAO,GACX,mEAAmE,CAAA;AAErE;;;;AAIG;AACUC,MAAAA,MAAM,GAAIC,KAAa,IAAI;EACtC,IAAIC,MAAM,GAAG,EAAE,CAAA;EACf,IAAIC,CAAC,GAAG,CAAC,CAAA;AAETF,EAAAA,KAAK,GAAGG,YAAY,CAACH,KAAK,CAAC,CAAA;AAE3B,EAAA,OAAOE,CAAC,GAAGF,KAAK,CAACI,MAAM,EAAE;IACvB,MAAMC,IAAI,GAAGL,KAAK,CAACM,UAAU,CAACJ,CAAC,EAAE,CAAC,CAAA;IAClC,MAAMK,IAAI,GAAGP,KAAK,CAACM,UAAU,CAACJ,CAAC,EAAE,CAAC,CAAA;IAClC,MAAMM,IAAI,GAAGR,KAAK,CAACM,UAAU,CAACJ,CAAC,EAAE,CAAC,CAAA;AAElC,IAAA,MAAMO,IAAI,GAAGJ,IAAI,IAAI,CAAC,CAAA;IACtB,MAAMK,IAAI,GAAI,CA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AY,CAAE,CAACK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAKC,EAAE,GAAG,EAAG,CAAC,CAAA;AAC1DvB,MAAAA,CAAC,IAAI,CAAC,CAAA;AACR,KAAC,MAAM;MACL,MAAMuB,EAAE,GAAGH,OAAO,CAAChB,UAAU,CAACJ,CAAC,GAAG,CAAC,CAAC,CAAA;MACpC,MAAMwB,EAAE,GAAGJ,OAAO,CAAChB,UAAU,CAACJ,CAAC,GAAG,CAAC,CAAC,CAAA;MACpCmB,MAAM,IAAIH,MAAM,CAACC,YAAY,CAC1B,CAACK,CAAC,GAAG,EAAE,KAAK,EAAE,GAAK,CAACC,EAAE,GAAG,EAAE,KAAK,CAAE,GAAIC,EAAE,GAAG,EAAG,CAChD,CAAA;AACDxB,MAAAA,CAAC,IAAI,CAAC,CAAA;AACR,KAAA;AACF,GAAA;AACA,EAAA,OAAOmB,MAAM,CAAA;AACf;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../index.ts"],"sourcesContent":["const _keyStr =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes given string.\n *\n * @param {string} input - Text to encode\n */\nexport const encode = (input: string) => {\n let output = '';\n let i = 0;\n\n input = _utf8_encode(input);\n\n while (i < input.length) {\n const chr1 = input.charCodeAt(i++);\n const chr2 = input.charCodeAt(i++);\n const chr3 = input.charCodeAt(i++);\n\n const enc1 = chr1 >> 2;\n const enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n let enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n let enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output =\n output +\n _keyStr.charAt(enc1) +\n _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) +\n _keyStr.charAt(enc4);\n }\n\n return output;\n};\n\n/**\n * Decodes given string.\n *\n * @param {string} input - Text to decode\n */\nexport const decode = (input: string) => {\n let output = '';\n let i = 0;\n\n input = input.replace(/[^A-Za-z0-9+/=]/g, '');\n\n while (i < input.length) {\n const enc1 = _keyStr.indexOf(input.charAt(i++));\n const enc2 = _keyStr.indexOf(input.charAt(i++));\n const enc3 = _keyStr.indexOf(input.charAt(i++));\n const enc4 = _keyStr.indexOf(input.charAt(i++));\n\n const chr1 = (enc1 << 2) | (enc2 >> 4);\n const chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n const chr3 = ((enc3 & 3) << 6) | enc4;\n\n output += String.fromCharCode(chr1);\n\n if (enc3 !== 64) {\n output += String.fromCharCode(chr2);\n }\n if (enc4 !== 64) {\n output += String.fromCharCode(chr3);\n }\n }\n\n return _utf8_decode(output);\n};\n\n/**\n * (private method) does a UTF-8 encoding\n *\n * @private\n * @param {string} string - Text to encode\n */\nfunction _utf8_encode(str: string): string {\n return encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_, p1) =>\n String.fromCharCode(parseInt(p1, 16)),\n );\n}\n\n/**\n * (private method - do not use) does a UTF-8 decoding\n *\n * @private\n * @param {string} utftext - UTF-8 text to dencode\n */\nfunction _utf8_decode(str: string): string {\n return decodeURIComponent(\n str\n .split('')\n .map((c) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))\n .join(''),\n );\n}\n"],"names":["_keyStr","encode","input","output","i","_utf8_encode","length","chr1","charCodeAt","chr2","chr3","enc1","enc2","enc3","enc4","isNaN","charAt","decode","replace","indexOf","String","fromCharCode","_utf8_decode","str","encodeURIComponent","_","p1","parseInt","decodeURIComponent","split","map","c","toString","slice","join"],"mappings":"AAAA,MAAMA,OAAO,GACX,mEAAmE,CAAA;AAErE;;;;AAIG;AACUC,MAAAA,MAAM,GAAIC,KAAa,IAAI;EACtC,IAAIC,MAAM,GAAG,EAAE,CAAA;EACf,IAAIC,CAAC,GAAG,CAAC,CAAA;AAETF,EAAAA,KAAK,GAAGG,YAAY,CAACH,KAAK,CAAC,CAAA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;EAC/B,OAAOC,kBAAkB,CAACD,GAAG,CAAC,CAACL,OAAO,CAAC,iBAAiB,EAAE,CAACO,CAAC,EAAEC,EAAE,KAC9DN,MAAM,CAACC,YAAY,CAACM,QAAQ,CAACD,EAAE,EAAE,EAAE,CAAC,CAAC,CACtC,CAAA;AACH,CAAA;AAEA;;;;;AAKG;AACH,SAASJ,YAAYA,CAACC,GAAW,EAAA;AAC/B,EAAA,OAAOK,kBAAkB,CACvBL,GAAG,CACAM,KAAK,CAAC,EAAE,CAAC,CACTC,GAAG,CAAEC,CAAC,IAAK,GAAG,GAAG,CAAC,IAAI,GAAGA,CAAC,CAACvB,UAAU,CAAC,CAAC,CAAC,CAACwB,QAAQ,CAAC,EAAE,CAAC,EAAEC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CACjEC,IAAI,CAAC,EAAE,CAAC,CACZ,CAAA;AACH;;;;;"}
package/dist/index.mjs CHANGED
@@ -1,9 +1,3 @@
1
- /**
2
- *
3
- * Base64 encode / decode
4
- * http://www.webtoolkit.info/
5
- *
6
- **/
7
1
  const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
8
2
  /**
9
3
  * Encodes given string.
@@ -48,15 +42,15 @@ const decode = input => {
48
42
  const chr1 = enc1 << 2 | enc2 >> 4;
49
43
  const chr2 = (enc2 & 15) << 4 | enc3 >> 2;
50
44
  const chr3 = (enc3 & 3) << 6 | enc4;
51
- output = output + String.fromCharCode(chr1);
52
- if (enc3 != 64) {
53
- output = output + String.fromCharCode(chr2);
45
+ output += String.fromCharCode(chr1);
46
+ if (enc3 !== 64) {
47
+ output += String.fromCharCode(chr2);
54
48
  }
55
- if (enc4 != 64) {
56
- output = output + String.fromCharCode(chr3);
49
+ if (enc4 !== 64) {
50
+ output += String.fromCharCode(chr3);
57
51
  }
58
52
  }
59
- return output = _utf8_decode(output);
53
+ return _utf8_decode(output);
60
54
  };
61
55
  /**
62
56
  * (private method) does a UTF-8 encoding
@@ -64,20 +58,8 @@ const decode = input => {
64
58
  * @private
65
59
  * @param {string} string - Text to encode
66
60
  */
67
- function _utf8_encode(string) {
68
- string = string.replace(/\r\n/g, '\n');
69
- let utftext = '';
70
- for (let n = 0; n < string.length; n++) {
71
- const c = string.charCodeAt(n);
72
- if (c < 128) {
73
- utftext += String.fromCharCode(c);
74
- } else if (c > 127 && c < 2048) {
75
- utftext += String.fromCharCode(c >> 6 | 192) + String.fromCharCode(c & 63 | 128);
76
- } else {
77
- utftext += String.fromCharCode(c >> 12 | 224) + String.fromCharCode(c >> 6 & 63 | 128) + String.fromCharCode(c & 63 | 128);
78
- }
79
- }
80
- return utftext;
61
+ function _utf8_encode(str) {
62
+ return encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)));
81
63
  }
82
64
  /**
83
65
  * (private method - do not use) does a UTF-8 decoding
@@ -85,26 +67,8 @@ function _utf8_encode(string) {
85
67
  * @private
86
68
  * @param {string} utftext - UTF-8 text to dencode
87
69
  */
88
- function _utf8_decode(utftext) {
89
- let string = '';
90
- let i = 0;
91
- while (i < utftext.length) {
92
- const c = utftext.charCodeAt(i);
93
- if (c < 128) {
94
- string += String.fromCharCode(c);
95
- i++;
96
- } else if (c > 191 && c < 224) {
97
- const c2 = utftext.charCodeAt(i + 1);
98
- string += String.fromCharCode((c & 31) << 6 | c2 & 63);
99
- i += 2;
100
- } else {
101
- const c2 = utftext.charCodeAt(i + 1);
102
- const c3 = utftext.charCodeAt(i + 2);
103
- string += String.fromCharCode((c & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
104
- i += 3;
105
- }
106
- }
107
- return string;
70
+ function _utf8_decode(str) {
71
+ return decodeURIComponent(str.split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join(''));
108
72
  }
109
73
 
110
74
  export { decode, encode };
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":["/**\n *\n * Base64 encode / decode\n * http://www.webtoolkit.info/\n *\n **/\n\nconst _keyStr =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes given string.\n *\n * @param {string} input - Text to encode\n */\nexport const encode = (input: string) => {\n let output = '';\n let i = 0;\n\n input = _utf8_encode(input);\n\n while (i < input.length) {\n const chr1 = input.charCodeAt(i++);\n const chr2 = input.charCodeAt(i++);\n const chr3 = input.charCodeAt(i++);\n\n const enc1 = chr1 >> 2;\n const enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n let enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n let enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output =\n output +\n _keyStr.charAt(enc1) +\n _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) +\n _keyStr.charAt(enc4);\n }\n\n return output;\n};\n\n/**\n * Decodes given string.\n *\n * @param {string} input - Text to decode\n */\nexport const decode = (input: string) => {\n let output = '';\n let i = 0;\n\n input = input.replace(/[^A-Za-z0-9+/=]/g, '');\n\n while (i < input.length) {\n const enc1 = _keyStr.indexOf(input.charAt(i++));\n const enc2 = _keyStr.indexOf(input.charAt(i++));\n const enc3 = _keyStr.indexOf(input.charAt(i++));\n const enc4 = _keyStr.indexOf(input.charAt(i++));\n\n const chr1 = (enc1 << 2) | (enc2 >> 4);\n const chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n const chr3 = ((enc3 & 3) << 6) | enc4;\n\n output = output + String.fromCharCode(chr1);\n\n if (enc3 != 64) {\n output = output + String.fromCharCode(chr2);\n }\n\n if (enc4 != 64) {\n output = output + String.fromCharCode(chr3);\n }\n }\n\n return (output = _utf8_decode(output));\n};\n\n/**\n * (private method) does a UTF-8 encoding\n *\n * @private\n * @param {string} string - Text to encode\n */\nfunction _utf8_encode(string: string) {\n string = string.replace(/\\r\\n/g, '\\n');\n let utftext = '';\n\n for (let n = 0; n < string.length; n++) {\n const c = string.charCodeAt(n);\n\n if (c < 128) {\n utftext += String.fromCharCode(c);\n } else if (c > 127 && c < 2048) {\n utftext +=\n String.fromCharCode((c >> 6) | 192) +\n String.fromCharCode((c & 63) | 128);\n } else {\n utftext +=\n String.fromCharCode((c >> 12) | 224) +\n String.fromCharCode(((c >> 6) & 63) | 128) +\n String.fromCharCode((c & 63) | 128);\n }\n }\n\n return utftext;\n}\n\n/**\n * (private method - do not use) does a UTF-8 decoding\n *\n * @private\n * @param {string} utftext - UTF-8 text to dencode\n */\nfunction _utf8_decode(utftext: string) {\n let string = '';\n let i = 0;\n\n while (i < utftext.length) {\n const c = utftext.charCodeAt(i);\n\n if (c < 128) {\n string += String.fromCharCode(c);\n i++;\n } else if (c > 191 && c < 224) {\n const c2 = utftext.charCodeAt(i + 1);\n string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n i += 2;\n } else {\n const c2 = utftext.charCodeAt(i + 1);\n const c3 = utftext.charCodeAt(i + 2);\n string += String.fromCharCode(\n ((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63),\n );\n i += 3;\n }\n }\n return string;\n}\n"],"names":["_keyStr","encode","input","output","i","_utf8_encode","length","chr1","charCodeAt","chr2","chr3","enc1","enc2","enc3","enc4","isNaN","charAt","decode","replace","indexOf","String","fromCharCode","_utf8_decode","string","utftext","n","c","c2","c3"],"mappings":"AAAA;;;;;AAKI;AAEJ,MAAMA,OAAO,GACX,mEAAmE,CAAA;AAErE;;;;AAIG;AACUC,MAAAA,MAAM,GAAIC,KAAa,IAAI;EACtC,IAAIC,MAAM,GAAG,EAAE,CAAA;EACf,IAAIC,CAAC,GAAG,CAAC,CAAA;AAETF,EAAAA,KAAK,GAAGG,YAAY,CAACH,KAAK,CAAC,CAAA;AAE3B,EAAA,OAAOE,CAAC,GAAGF,KAAK,CAACI,MAAM,EAAE;IACvB,MAAMC,IAAI,G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AAAA,MAAM,IAAIH,MAAM,CAACC,YAAY,CAACK,CAAC,CAAC,CAAA;AAChCtB,MAAAA,CAAC,EAAE,CAAA;KACJ,MAAM,IAAIsB,CAAC,GAAG,GAAG,IAAIA,CAAC,GAAG,GAAG,EAAE;MAC7B,MAAMC,EAAE,GAAGH,OAAO,CAAChB,UAAU,CAACJ,CAAC,GAAG,CAAC,CAAC,CAAA;AACpCmB,MAAAA,MAAM,IAAIH,MAAM,CAACC,YAAY,CAAE,CAACK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAKC,EAAE,GAAG,EAAG,CAAC,CAAA;AAC1DvB,MAAAA,CAAC,IAAI,CAAC,CAAA;AACR,KAAC,MAAM;MACL,MAAMuB,EAAE,GAAGH,OAAO,CAAChB,UAAU,CAACJ,CAAC,GAAG,CAAC,CAAC,CAAA;MACpC,MAAMwB,EAAE,GAAGJ,OAAO,CAAChB,UAAU,CAACJ,CAAC,GAAG,CAAC,CAAC,CAAA;MACpCmB,MAAM,IAAIH,MAAM,CAACC,YAAY,CAC1B,CAACK,CAAC,GAAG,EAAE,KAAK,EAAE,GAAK,CAACC,EAAE,GAAG,EAAE,KAAK,CAAE,GAAIC,EAAE,GAAG,EAAG,CAChD,CAAA;AACDxB,MAAAA,CAAC,IAAI,CAAC,CAAA;AACR,KAAA;AACF,GAAA;AACA,EAAA,OAAOmB,MAAM,CAAA;AACf;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":["const _keyStr =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes given string.\n *\n * @param {string} input - Text to encode\n */\nexport const encode = (input: string) => {\n let output = '';\n let i = 0;\n\n input = _utf8_encode(input);\n\n while (i < input.length) {\n const chr1 = input.charCodeAt(i++);\n const chr2 = input.charCodeAt(i++);\n const chr3 = input.charCodeAt(i++);\n\n const enc1 = chr1 >> 2;\n const enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n let enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n let enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output =\n output +\n _keyStr.charAt(enc1) +\n _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) +\n _keyStr.charAt(enc4);\n }\n\n return output;\n};\n\n/**\n * Decodes given string.\n *\n * @param {string} input - Text to decode\n */\nexport const decode = (input: string) => {\n let output = '';\n let i = 0;\n\n input = input.replace(/[^A-Za-z0-9+/=]/g, '');\n\n while (i < input.length) {\n const enc1 = _keyStr.indexOf(input.charAt(i++));\n const enc2 = _keyStr.indexOf(input.charAt(i++));\n const enc3 = _keyStr.indexOf(input.charAt(i++));\n const enc4 = _keyStr.indexOf(input.charAt(i++));\n\n const chr1 = (enc1 << 2) | (enc2 >> 4);\n const chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n const chr3 = ((enc3 & 3) << 6) | enc4;\n\n output += String.fromCharCode(chr1);\n\n if (enc3 !== 64) {\n output += String.fromCharCode(chr2);\n }\n if (enc4 !== 64) {\n output += String.fromCharCode(chr3);\n }\n }\n\n return _utf8_decode(output);\n};\n\n/**\n * (private method) does a UTF-8 encoding\n *\n * @private\n * @param {string} string - Text to encode\n */\nfunction _utf8_encode(str: string): string {\n return encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_, p1) =>\n String.fromCharCode(parseInt(p1, 16)),\n );\n}\n\n/**\n * (private method - do not use) does a UTF-8 decoding\n *\n * @private\n * @param {string} utftext - UTF-8 text to dencode\n */\nfunction _utf8_decode(str: string): string {\n return decodeURIComponent(\n str\n .split('')\n .map((c) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))\n .join(''),\n );\n}\n"],"names":["_keyStr","encode","input","output","i","_utf8_encode","length","chr1","charCodeAt","chr2","chr3","enc1","enc2","enc3","enc4","isNaN","charAt","decode","replace","indexOf","String","fromCharCode","_utf8_decode","str","encodeURIComponent","_","p1","parseInt","decodeURIComponent","split","map","c","toString","slice","join"],"mappings":"AAAA,MAAMA,OAAO,GACX,mEAAmE,CAAA;AAErE;;;;AAIG;AACUC,MAAAA,MAAM,GAAIC,KAAa,IAAI;EACtC,IAAIC,MAAM,GAAG,EAAE,CAAA;EACf,IAAIC,CAAC,GAAG,CAAC,CAAA;AAETF,EAAAA,KAAK,GAAGG,YAAY,CAACH,KAAK,CAAC,CAAA;AAE3B,EAAA,OAAOE,CAAC,GAAGF,KAAK,CAACI,MAAM,EAAE;IACvB,MAAMC,IAAI,GAAGL,KAAK,CAACM,UAAU,CAACJ,CAAC,EAAE,CAAC,CAAA;IAClC,MAAMK,IAAI,GAAGP,KAAK,CAACM,UAAU,CAACJ,CAAC,EAAE,CAAC,CAAA;IAClC,MAAMM,IAAI,GAAGR,KAAK,CAACM,UAAU,CAACJ,CAAC,EAAE,CAAC,CAAA;AAElC,IAAA,MAAMO,IAAI,GAAGJ,IAAI,IAAI,CAAC,CAAA;IACtB,MAAMK,IAAI,GAAI,CAACL,IAAI,GAAG,CAAC,KAAK,CAAC,GAAKE,IAAI,IAAI,CAAE,CAAA;IAC5C,IAAII,IAAI,GAAI,CAACJ,IAAI,GAAG,EAAE,KAAK,CAAC,GAAKC,IAAI,IAAI,CAAE,CAAA;AAC3C,IAAA,IAAII,IAAI,GAAGJ,IAAI,GAAG,EAAE,CAAA;AAEpB,IAAA,IAAIK,KAAK,CAACN,IAAI,CAAC,EAAE;MACfI,IAAI,GAAGC,IAAI,GAAG,EAAE,CAAA;AAClB,KAAC,MAAM,IAAIC,KAAK,CAACL,IAAI,CAAC,EAAE;AACtBI,MAAAA,IAAI,GAAG,EAAE,CAAA;AACX,KAAA;AAEAX,IAAAA,MAAM,GACJA,MAAM,GACNH,OAAO,CAACgB,MAAM,CAACL,IAAI,CAAC,GACpBX,OAAO,CAACgB,MAAM,CAACJ,IAAI,CAAC,GACpBZ,OAAO,CAACgB,MAAM,CA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MAAM,CAACC,YAAY,CAACZ,IAAI,CAAC,CAAA;AACrC,KAAA;IACA,IAAIK,IAAI,KAAK,EAAE,EAAE;AACfX,MAAAA,MAAM,IAAIiB,MAAM,CAACC,YAAY,CAACX,IAAI,CAAC,CAAA;AACrC,KAAA;AACF,GAAA;EAEA,OAAOY,YAAY,CAACnB,MAAM,CAAC,CAAA;AAC7B,EAAC;AAED;;;;;AAKG;AACH,SAASE,YAAYA,CAACkB,GAAW,EAAA;EAC/B,OAAOC,kBAAkB,CAACD,GAAG,CAAC,CAACL,OAAO,CAAC,iBAAiB,EAAE,CAACO,CAAC,EAAEC,EAAE,KAC9DN,MAAM,CAACC,YAAY,CAACM,QAAQ,CAACD,EAAE,EAAE,EAAE,CAAC,CAAC,CACtC,CAAA;AACH,CAAA;AAEA;;;;;AAKG;AACH,SAASJ,YAAYA,CAACC,GAAW,EAAA;AAC/B,EAAA,OAAOK,kBAAkB,CACvBL,GAAG,CACAM,KAAK,CAAC,EAAE,CAAC,CACTC,GAAG,CAAEC,CAAC,IAAK,GAAG,GAAG,CAAC,IAAI,GAAGA,CAAC,CAACvB,UAAU,CAAC,CAAC,CAAC,CAACwB,QAAQ,CAAC,EAAE,CAAC,EAAEC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CACjEC,IAAI,CAAC,EAAE,CAAC,CACZ,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frsource/base64",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
4
4
  "description": "base64 encoder/decoder with UTF-8 support 📔",
5
5
  "repository": "https://github.com/FRSOURCE/base64.git",
6
6
  "homepage": "http://www.webtoolkit.info/javascript_base64.html",