|
|
@ -20,7 +20,7 @@ const _fromCC = String.fromCharCode.bind(String); |
|
|
* polyfill version of `btoa` |
|
|
* polyfill version of `btoa` |
|
|
*/ |
|
|
*/ |
|
|
const btoaPolyfill = (bin) => { |
|
|
const btoaPolyfill = (bin) => { |
|
|
// console.log('polyfilled');
|
|
|
|
|
|
let u32, c0, c1, c2, asc = '' |
|
|
let u32, c0, c1, c2, asc = '' |
|
|
const pad = bin.length % 3 |
|
|
const pad = bin.length % 3 |
|
|
for (let i = 0;i < bin.length;) { |
|
|
for (let i = 0;i < bin.length;) { |
|
|
@ -41,7 +41,7 @@ const btoaPolyfill = (bin) => { |
|
|
* polyfill version of `atob` |
|
|
* polyfill version of `atob` |
|
|
*/ |
|
|
*/ |
|
|
const atobPolyfill = (asc) => { |
|
|
const atobPolyfill = (asc) => { |
|
|
// console.log('polyfilled');
|
|
|
|
|
|
asc = asc.replace(/\s+/g, '') |
|
|
asc = asc.replace(/\s+/g, '') |
|
|
if (!b64re.test(asc)) |
|
|
if (!b64re.test(asc)) |
|
|
throw new TypeError('malformed base64.') |
|
|
throw new TypeError('malformed base64.') |
|
|
|