Skip to content

Commit

Permalink
improve hexToString
Browse files Browse the repository at this point in the history
  • Loading branch information
wseymour15 committed Oct 11, 2023
1 parent 28d0317 commit 56a3d9d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/m2ts/caption-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,12 +690,9 @@ Cea708Stream.prototype.handleText = function(i, service, options) {

// Converts an array of bytes to a unicode hex string.
function toHexString(byteArray) {
const newArr = [];
byteArray.forEach((byte) => {
newArr.push(('0' + (byte & 0xFF).toString(16)).slice(-2));
});

return newArr.join('');
return byteArray.map((byte) => {
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join('');
};

if (isMultiByte) {
Expand Down

0 comments on commit 56a3d9d

Please sign in to comment.