1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-23 08:38:06 +02:00

Merge pull request #18978 from Snuffleupagus/toHexUtil-simplify

Re-factor the `toHexUtil` helper (PR 17862 follow-up)
This commit is contained in:
Jonas Jenwald 2024-10-29 17:10:36 +01:00 committed by GitHub
commit f013c39b9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1102,11 +1102,7 @@ function toHexUtil(arr) {
if (Uint8Array.prototype.toHex) {
return arr.toHex();
}
const buf = [];
for (const num of arr) {
buf.push(num.toString(16).padStart(2, "0"));
}
return buf.join("");
return Array.from(arr, num => hexNumbers[num]).join("");
}
// TODO: Remove this once `Uint8Array.prototype.toBase64` is generally