Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Nov 21, 2024
1 parent ec7737b commit bb9d159
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit bb9d159

Please sign in to comment.