MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / toHexString

Function toHexString

modules/network/ble/btutils.js:120–129  ·  view source on GitHub ↗
(buffer, delimiter = '')

Source from the content-addressed store, hash-verified

118
119const hex = "0123456789ABCDEF";
120function toHexString(buffer, delimiter = '') {
121 const bytes = new Uint8Array(buffer);
122 const length = buffer.byteLength;
123 let result = new Array(length);
124 for (let index = 0; index < length; ++index) {
125 const byte = bytes[index];
126 result[length - index - 1] = hex[byte >> 4] + hex[byte & 0x0F];
127 }
128 return result.join(delimiter);
129}
130
131export class Bytes extends ArrayBuffer {
132 constructor(bytes, littleEndian) {

Callers 1

toStringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected