@midnight-ntwrk/midnight-js-utils v0.2.5 • API
Midnight.js API Reference v0.2.5 / @midnight-ntwrk/midnight-js-utils / parseHex
Function: parseHex()
parseHex(
source
):ParsedHexString
Parses a string as a hex-encoded string.
Parameters
• source: string
The source string to parse.
Returns
A ParsedHexString describing the parsed elements of source
.
Example
parseHex('Hello') =>
{
hasPrefix: false,
incompleteChars: 'Hello'
}
Example
parseHex('ab12e') =>
{
hasPrefix: false,
byteChars: 'ab12'
incompleteChars: 'e'
}
Example
parseHex('0xab12') =>
{
hasPrefix: true,
byteChars: 'ab12'
incompleteChars: ''
}