1 | (function (w) {
|
2 | "use strict";
|
3 |
|
4 | function findBest(atobNative) {
|
5 |
|
6 | if ('function' === typeof atobNative) { return atobNative; }
|
7 |
|
8 |
|
9 |
|
10 | if ('function' === typeof Buffer) {
|
11 | return function atobBrowserify(a) {
|
12 |
|
13 |
|
14 |
|
15 | return new Buffer(a, 'base64').toString('binary');
|
16 | };
|
17 | }
|
18 |
|
19 |
|
20 | if ('object' === typeof w.base64js) {
|
21 |
|
22 |
|
23 | return function atobWebWorker_iOS(a) {
|
24 | var buf = w.base64js.b64ToByteArray(a);
|
25 | return Array.prototype.map.call(buf, function (ch) {
|
26 | return String.fromCharCode(ch);
|
27 | }).join('');
|
28 | };
|
29 | }
|
30 |
|
31 | return function () {
|
32 |
|
33 | throw new Error("You're probably in an old browser or an iOS webworker." +
|
34 | " It might help to include beatgammit's base64-js.");
|
35 | };
|
36 | }
|
37 |
|
38 | var atobBest = findBest(w.atob);
|
39 | w.atob = atobBest;
|
40 |
|
41 | if ((typeof module === 'object') && module && module.exports) {
|
42 | module.exports = atobBest;
|
43 | }
|
44 | }(window));
|