diff --git a/src/lib/BufferUtils.ts b/src/lib/BufferUtils.ts index a16d0ed0..4dc22aad 100644 --- a/src/lib/BufferUtils.ts +++ b/src/lib/BufferUtils.ts @@ -1,13 +1,13 @@ export function hexToBytes(hex: string) { - return new Uint8Array((hex.match(/.{2}/g) || []).map(byte => parseInt(byte, 16))); + return new Uint8Array((hex.match(/.{2}/g) || []).map((byte) => parseInt(byte, 16))); } export function bytesToHex(bytes: Uint8Array) { const HEX_ALPHABET = '0123456789abcdef'; let hex = ''; - for (let i = 0; i < bytes.length; i++) { - const code = bytes[i]; + for (const code of bytes) { + // tslint:disable:no-bitwise hex += HEX_ALPHABET[code >>> 4]; hex += HEX_ALPHABET[code & 0x0F]; }