File tree Expand file tree Collapse file tree 3 files changed +27
-20
lines changed Expand file tree Collapse file tree 3 files changed +27
-20
lines changed Original file line number Diff line number Diff line change 3232 $(ESLINT ) \
3333 --config node_modules/sanctuary-style/eslint-es3.json \
3434 --global $$ \
35+ --global define \
3536 --global exports \
37+ --global module \
3638 --global self \
3739 --rule ' max-len: [off]' \
3840 --rule ' no-plusplus: [off]' \
Original file line number Diff line number Diff line change 22
33[ ![ CDNJS] ( https://img.shields.io/cdnjs/v/Base64.svg )] ( https://cdnjs.com/libraries/Base64 )
44
5- ≈ 600 byte* polyfill for browsers which don't provide [ ` window.btoa ` ] [ 1 ] and
5+ ≈ 700 byte* polyfill for browsers which don't provide [ ` window.btoa ` ] [ 1 ] and
66[ ` window.atob ` ] [ 2 ] .
77
88Base64.js stems from a [ gist] [ 3 ] by [ yahiko] [ 4 ] .
Original file line number Diff line number Diff line change 1- ( function ( ) {
1+ ( function ( f ) {
22
33 'use strict' ;
44
5- var object = (
6- // #34: CommonJS
7- typeof exports === 'object' && exports != null &&
8- typeof exports . nodeType !== 'number' ?
9- exports :
10- // #8: web workers
11- typeof self !== 'undefined' ?
12- self :
13- // #31: ExtendScript
14- $ . global
15- ) ;
5+ /* istanbul ignore else */
6+ if ( typeof exports === 'object' && exports != null &&
7+ typeof exports . nodeType !== 'number' ) {
8+ module . exports = f ( ) ;
9+ } else if ( typeof define === 'function' && define . amd != null ) {
10+ define ( [ ] , f ) ;
11+ } else {
12+ var base64 = f ( ) ;
13+ var global = typeof self !== 'undefined' ? self : $ . global ;
14+ if ( typeof global . btoa !== 'function' ) global . btoa = base64 . btoa ;
15+ if ( typeof global . atob !== 'function' ) global . atob = base64 . atob ;
16+ }
17+
18+ } ( function ( ) {
19+
20+ 'use strict' ;
1621
1722 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' ;
1823
2429
2530 // encoder
2631 // [https://gist.github.com/999166] by [https://github.com/nignag]
27- object . btoa || (
28- object . btoa = function ( input ) {
32+ function btoa ( input ) {
2933 var str = String ( input ) ;
3034 for (
3135 // initialize result and counter
4448 block = block << 8 | charCode ;
4549 }
4650 return output ;
47- } ) ;
51+ }
4852
4953 // decoder
5054 // [https://gist.github.com/1020396] by [https://github.com/atk]
51- object . atob || (
52- object . atob = function ( input ) {
55+ function atob ( input ) {
5356 var str = ( String ( input ) ) . replace ( / [ = ] + $ / , '' ) ; // #31: ExtendScript bad parse of /=
5457 if ( str . length % 4 === 1 ) {
5558 throw new InvalidCharacterError ( "'atob' failed: The string to be decoded is not correctly encoded." ) ;
6972 buffer = chars . indexOf ( buffer ) ;
7073 }
7174 return output ;
72- } ) ;
75+ }
76+
77+ return { btoa : btoa , atob : atob } ;
7378
74- } ( ) ) ;
79+ } ) ) ;
You can’t perform that action at this time.
0 commit comments