MCPcopy
hub / github.com/colinhacks/zod / preprocess

Function preprocess

packages/zod/src/v4/classic/schemas.ts:2663–2672  ·  view source on GitHub ↗
(
  fn: (arg: B, ctx: core.$RefinementCtx) => A,
  schema: U
)

Source from the content-addressed store, hash-verified

2661// preprocess
2662
2663export function preprocess<A, U extends core.SomeType, B = unknown>(
2664 fn: (arg: B, ctx: core.$RefinementCtx) => A,
2665 schema: U
2666): ZodPreprocess<U> {
2667 return new ZodPreprocess({
2668 type: "pipe",
2669 in: transform(fn as any) as any as core.$ZodTransform,
2670 out: schema as any as core.$ZodType,
2671 }) as any;
2672}

Callers

nothing calls this directly

Calls 1

transformFunction · 0.70

Tested by

no test coverage detected