deno.land / x / sheetjs@v0.18.3 / modules / 04_base64.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var Base64 = (() => { var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; return { encode: function(input: string): string { var o = ""; var c1=0, c2=0, c3=0, e1=0, e2=0, e3=0, e4=0; for(var i = 0; i < input.length; ) { c1 = input.charCodeAt(i++); e1 = (c1 >> 2);
c2 = input.charCodeAt(i++); e2 = ((c1 & 3) << 4) | (c2 >> 4);
c3 = input.charCodeAt(i++); e3 = ((c2 & 15) << 2) | (c3 >> 6); e4 = (c3 & 63); if (isNaN(c2)) { e3 = e4 = 64; } else if (isNaN(c3)) { e4 = 64; } o += map.charAt(e1) + map.charAt(e2) + map.charAt(e3) + map.charAt(e4); } return o; }, decode: function(input: string): string { var o = ""; var c1=0, c2=0, c3=0, e1=0, e2=0, e3=0, e4=0; input = input.replace(/[^\w\+\/\=]/g, ""); for(var i = 0; i < input.length;) { e1 = map.indexOf(input.charAt(i++)); e2 = map.indexOf(input.charAt(i++)); c1 = (e1 << 2) | (e2 >> 4); o += String.fromCharCode(c1);
e3 = map.indexOf(input.charAt(i++)); c2 = ((e2 & 15) << 4) | (e3 >> 2); if (e3 !== 64) { o += String.fromCharCode(c2); }
e4 = map.indexOf(input.charAt(i++)); c3 = ((e3 & 3) << 6) | e4; if (e4 !== 64) { o += String.fromCharCode(c3); } } return o; } };})();
sheetjs
📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
GitHub RepositorySheetJS/sheetjs
GitHub Stars
32183

Version Info

Tagged at
11 months ago