@exodus/bytes 1.0.0-rc.0 → 1.0.0-rc.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/base64.js +3 -2
- package/hex.js +1 -1
- package/package.json +1 -1
package/base64.js
CHANGED
|
@@ -77,8 +77,9 @@ if (Uint8Array.fromBase64) {
|
|
|
77
77
|
if (!haveNativeBuffer && atob) {
|
|
78
78
|
// atob is faster than manual parsing on Hermes
|
|
79
79
|
const raw = atob(isBase64url ? str.replaceAll('-', '+').replaceAll('_', '/') : str)
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const length = raw.length
|
|
81
|
+
arr = new Uint8Array(length)
|
|
82
|
+
for (let i = 0; i < length; i++) arr[i] = raw.charCodeAt(i)
|
|
82
83
|
} else {
|
|
83
84
|
// base64url is already checked to have no padding via a regex above
|
|
84
85
|
if (!isBase64url) {
|
package/hex.js
CHANGED
|
@@ -20,7 +20,7 @@ export function toHex(arr) {
|
|
|
20
20
|
if (!hexArray) hexArray = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'))
|
|
21
21
|
const length = arr.length // this helps Hermes
|
|
22
22
|
|
|
23
|
-
if (length >
|
|
23
|
+
if (length > 30000) {
|
|
24
24
|
// Limit concatenation to avoid excessive GC
|
|
25
25
|
// Thresholds checked on Hermes
|
|
26
26
|
const concat = []
|