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

Function withTrustedDecode

packages/effect/src/encoding/SchemaBinary.ts:5468–5480  ·  view source on GitHub ↗
(
  target: Schema.Constraint,
  trusted: Trusted,
  bypassEncode: boolean
)

Source from the content-addressed store, hash-verified

5466// only lets values the binary layer just produced through, so every other
5467// input, `Schema.is` included, still runs the real check.
5468function withTrustedDecode(
5469 target: Schema.Constraint,
5470 trusted: Trusted,
5471 bypassEncode: boolean
5472): Schema.Constraint {
5473 return bypassPass(
5474 target,
5475 (input) => takeTrusted(trusted, input),
5476 // A recursive schema keeps the pass on encode: decoding cannot build a
5477 // cycle, but a caller can hand one in, and the cycle walk lives there.
5478 bypassEncode ? reportsExcess : constFalse
5479 )
5480}
5481
5482function constFalse(): boolean {
5483 return false

Callers 2

toCodecFunction · 0.85
toCodecStrictFunction · 0.85

Calls 2

bypassPassFunction · 0.85
takeTrustedFunction · 0.85

Tested by

no test coverage detected