From bb9d159aca78f77d70a36594d2c6817a79b73c27 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Thu, 21 Nov 2024 09:48:18 +0000 Subject: [PATCH] Add some comments --- index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/index.ts b/index.ts index 5a9dc15..6870d14 100644 --- a/index.ts +++ b/index.ts @@ -548,12 +548,21 @@ function genBech32(encoding: 'bech32' | 'bech32m'): Bech32 { }; } +/** + * Low-level bech32 operations. + */ export const bech32: Bech32 = /* @__PURE__ */ genBech32('bech32'); export const bech32m: Bech32 = /* @__PURE__ */ genBech32('bech32m'); declare const TextEncoder: any; declare const TextDecoder: any; +/** + * UTF-8-to-byte decoder. Uses built-in TextDecoder / TextEncoder. + * @example + * const b = utf8.decode("hey"); // => new Uint8Array([ 104, 101, 121 ]) + * const str = utf8.encode(b); // "hey" + */ export const utf8: BytesCoder = { encode: (data) => new TextDecoder().decode(data), decode: (str) => new TextEncoder().encode(str),