File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " voltranjs" ,
3- "version" : " 1.2.0-beta.21 " ,
3+ "version" : " 1.2.0-beta.23 " ,
44 "main" : " src/index.js" ,
55 "author" : " Hepsiburada Technology Team" ,
66 "bin" : {
Original file line number Diff line number Diff line change @@ -68,11 +68,18 @@ export function convertBase64(value, type) {
6868 }
6969
7070 if ( type === 'btoa' ) {
71- return Buffer . from ( value , 'utf8' ) . toString ( 'base64' ) ;
71+ if ( ! process . env . BROWSER ) {
72+ return Buffer . from ( value , 'utf8' ) . toString ( 'base64' ) ;
73+ }
74+ return btoa ( value ) ;
7275 }
7376 if ( type === 'atob' ) {
74- return Buffer . from ( value , 'base64' ) . toString ( 'utf8' ) ;
77+ if ( ! process . env . BROWSER ) {
78+ return Buffer . from ( value , 'base64' ) . toString ( 'utf8' ) ;
79+ }
80+ return atob ( value ) ;
7581 }
82+
7683 throw new Error ( "Type parameter must be 'atob' or 'btoa'." ) ;
7784 } catch ( error ) {
7885 console . error ( 'Error while converting:' , error ) ;
You can’t perform that action at this time.
0 commit comments