Skip to content

Commit 6ee14a5

Browse files
committed
v1.2.0-beta.22
1 parent 274eb29 commit 6ee14a5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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": {

src/universal/utils/helper.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)