@lowentry/utils 1.25.1 → 1.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -14
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/LeUtils.js +2 -16
package/package.json
CHANGED
package/src/LeUtils.js
CHANGED
|
@@ -2982,14 +2982,7 @@ export const LeUtils = {
|
|
|
2982
2982
|
base64ToBytes:
|
|
2983
2983
|
(base64string) =>
|
|
2984
2984
|
{
|
|
2985
|
-
|
|
2986
|
-
const len = binary.length;
|
|
2987
|
-
let data = new Uint8Array(len);
|
|
2988
|
-
for(let i = 0; i < len; i++)
|
|
2989
|
-
{
|
|
2990
|
-
data[i] = binary.charCodeAt(i);
|
|
2991
|
-
}
|
|
2992
|
-
return data;
|
|
2985
|
+
return Uint8Array.from(LeUtils.atob(base64string.trim()), c => c.charCodeAt(0));
|
|
2993
2986
|
},
|
|
2994
2987
|
|
|
2995
2988
|
/**
|
|
@@ -3001,14 +2994,7 @@ export const LeUtils = {
|
|
|
3001
2994
|
bytesToBase64:
|
|
3002
2995
|
(arraybuffer) =>
|
|
3003
2996
|
{
|
|
3004
|
-
|
|
3005
|
-
const len = bytes.byteLength;
|
|
3006
|
-
let binary = '';
|
|
3007
|
-
for(let i = 0; i < len; i++)
|
|
3008
|
-
{
|
|
3009
|
-
binary += String.fromCharCode(bytes[i]);
|
|
3010
|
-
}
|
|
3011
|
-
return LeUtils.btoa(binary);
|
|
2997
|
+
return LeUtils.btoa(String.fromCharCode(...new Uint8Array(arraybuffer)));
|
|
3012
2998
|
},
|
|
3013
2999
|
|
|
3014
3000
|
/**
|