MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / hexToBase64

Function hexToBase64

pkg/webui/console/lib/bytes.js:21–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 * @returns {string} - `str` base64 encoded.
20 */
21export const hexToBase64 = str =>
22 btoa(
23 String.fromCharCode.apply(
24 null,
25 str
26 .replace(/\r|\n/g, '')
27 .replace(/([\da-fA-F]{2}) ?/g, '0x$1 ')
28 .replace(/ +$/, '')
29 .split(' '),
30 ),
31 )
32
33/**
34 * Converts base64 encoded string to hex.

Callers 4

index.jsFile · 0.90
index.jsFile · 0.90
bytes_test.jsFile · 0.90
DevicePayloadFormattersFunction · 0.90

Calls 3

replaceMethod · 0.80
applyMethod · 0.65
splitMethod · 0.45

Tested by

no test coverage detected