( id: string, decode: (s: string) => either_.Either<Uint8Array, Encoding.DecodeException>, encode: (u: Uint8Array) => string )
| 6242 | } |
| 6243 | |
| 6244 | const makeUint8ArrayTransformation = ( |
| 6245 | id: string, |
| 6246 | decode: (s: string) => either_.Either<Uint8Array, Encoding.DecodeException>, |
| 6247 | encode: (u: Uint8Array) => string |
| 6248 | ) => |
| 6249 | transformOrFail( |
| 6250 | String$.annotations({ description: "a string to be decoded into a Uint8Array" }), |
| 6251 | Uint8ArrayFromSelf, |
| 6252 | { |
| 6253 | strict: true, |
| 6254 | decode: (i, _, ast) => |
| 6255 | either_.mapLeft( |
| 6256 | decode(i), |
| 6257 | (decodeException) => new ParseResult.Type(ast, i, decodeException.message) |
| 6258 | ), |
| 6259 | encode: (a) => ParseResult.succeed(encode(a)) |
| 6260 | } |
| 6261 | ).annotations({ identifier: id }) |
| 6262 | |
| 6263 | /** |
| 6264 | * Decodes a base64 (RFC4648) encoded string into a `Uint8Array`. |
no test coverage detected
searching dependent graphs…