@frsource/base64 1.0.23 → 1.0.24
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.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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)
|
|
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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AAG,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;AACP,KAAA,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;AACP,KAAA;AACF,GAAA;AACD,EAAA,OAAOmB,MAAM,CAAA;AACf;;;;;"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -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)
|
|
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,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;AACjB,KAAA,MAAM,IAAIC,KAAK,CAACL,IAAI,CAAC,EAAE;AACtBI,MAAAA,IAAI,GAAG,EAAE,CAAA;AACV,KAAA;AAEDX,IAAAA,MAAM,GACJA,MAAM,GACNH,OAAO,CAACgB,MAAM,CAACL,IAAI,CAAC,GACpBX,OAAO,CAACgB,MAAM,CAACJ,IAAI,C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EAAA,OAAOmB,MAAM,CAAA;AACf;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frsource/base64",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
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",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@semantic-release/npm": "10.0.5",
|
|
40
40
|
"del-cli": "5.0.1",
|
|
41
41
|
"microbundle": "0.15.1",
|
|
42
|
-
"prettier": "
|
|
42
|
+
"prettier": "3.0.2",
|
|
43
43
|
"semantic-release": "21.1.1"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|