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

Function decodeHex

packages/effect/src/SchemaGetter.ts:1481–1495  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1479 * @since 4.0.0
1480 */
1481export function decodeHex<E extends string>(): Getter<Uint8Array, E> {
1482 return transformOrFail((input, options) =>
1483 Result.match(Encoding.decodeHex(input), {
1484 onFailure: () =>
1485 Effect.fail(
1486 new SchemaIssue.InvalidValue(
1487 { expected: "a valid hexadecimal string" },
1488 input,
1489 options
1490 )
1491 ),
1492 onSuccess: Effect.succeed
1493 })
1494 )
1495}
1496
1497/**
1498 * Decodes a hexadecimal string to a UTF-8 `string`.

Callers

nothing calls this directly

Calls 2

transformOrFailFunction · 0.70
failMethod · 0.45

Tested by

no test coverage detected