MCPcopy Create free account
hub / github.com/Effect-TS/effect / encodeWithWellFormedString

Function encodeWithWellFormedString

packages/effect/src/SchemaGetter.ts:1504–1510  ·  view source on GitHub ↗
(encode: (input: E) => string)

Source from the content-addressed store, hash-verified

1502}
1503
1504function 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.

Callers 4

encodeBase64Function · 0.85
encodeBase64UrlFunction · 0.85
encodeHexFunction · 0.85
encodeUriComponentFunction · 0.85

Calls 4

transformEffectFunction · 0.70
encodeFunction · 0.70
failMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected