UNPKG
merkle-reference
Version:
latest (2.2.0)
2.2.0
2.1.0
2.0.1
1.1.0
0.0.3
0.0.2
0.0.1
0.0.0
This is a TS library implementing [merkle reference] specification.
merkle-reference
/
src
/
utf8.js
13 lines
(10 loc)
•
285 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
export
const
encoder =
new
TextEncoder
()
export
const
decoder =
new
TextDecoder
()
/** * @type {(text: string) => Uint8Array} */
export
const
toUTF8 = encoder.encode.
bind
(encoder)
/** * @type {(bytes: Uint8Array) => string} */
export
const
fromUTF8 = decoder.decode.
bind
(decoder)