Skip to content

Commit

Permalink
Merge pull request #18978 from Snuffleupagus/toHexUtil-simplify
Browse files Browse the repository at this point in the history
Re-factor the `toHexUtil` helper (PR 17862 follow-up)
  • Loading branch information
Snuffleupagus authored Oct 29, 2024
2 parents f142fb8 + db1238a commit f013c39
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f013c39

Please sign in to comment.