(char: number, alphabet: Uint8Array)
| 66 | } |
| 67 | |
| 68 | function getByte(char: number, alphabet: Uint8Array): number { |
| 69 | const byte = alphabet[char] ?? 16; |
| 70 | if (byte === 16) { // alphabet.Hex.length |
| 71 | throw new TypeError( |
| 72 | `Cannot decode input as hex: Invalid character (${ |
| 73 | String.fromCharCode(char) |
| 74 | })`, |
| 75 | ); |
| 76 | } |
| 77 | return byte; |
| 78 | } |