(encode: (input: E) => string)
| 1502 | } |
| 1503 | |
| 1504 | function encodeWithWellFormedString<E extends string | Uint8Array>(encode: (input: E) => string): Getter<string, E> { |
| 1505 | return transformEffect((input, options) => |
| 1506 | typeof input === "string" && !Str.isWellFormed(input) |
| 1507 | ? Effect.fail(new SchemaIssue.InvalidValue({ expected: "a well-formed Unicode string" }, input, options)) |
| 1508 | : Effect.succeed(encode(input)) |
| 1509 | ) |
| 1510 | } |
| 1511 | |
| 1512 | /** |
| 1513 | * Encodes a `Uint8Array` or string to a Base64 string. |
no test coverage detected