Skip to content

Commit 56a3d9d

Browse files
committed
improve hexToString
1 parent 28d0317 commit 56a3d9d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/m2ts/caption-stream.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,9 @@ Cea708Stream.prototype.handleText = function(i, service, options) {
690690

691691
// Converts an array of bytes to a unicode hex string.
692692
function toHexString(byteArray) {
693-
const newArr = [];
694-
byteArray.forEach((byte) => {
695-
newArr.push(('0' + (byte & 0xFF).toString(16)).slice(-2));
696-
});
697-
698-
return newArr.join('');
693+
return byteArray.map((byte) => {
694+
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
695+
}).join('');
699696
};
700697

701698
if (isMultiByte) {

0 commit comments

Comments
 (0)