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

Function handleCanaryResult

packages/zod/src/v4/core/schemas.ts:262–276  ·  view source on GitHub ↗
(canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal)

Source from the content-addressed store, hash-verified

260 };
261
262 const handleCanaryResult = (canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal) => {
263 // abort if the canary is aborted
264 if (util.aborted(canary)) {
265 canary.aborted = true;
266 return canary;
267 }
268
269 // run checks first, then
270 const checkResult = runChecks(payload, checks, ctx);
271 if (checkResult instanceof Promise) {
272 if (ctx.async === false) throw new core.$ZodAsyncError();
273 return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
274 }
275 return inst._zod.parse(checkResult, ctx);
276 };
277
278 inst._zod.run = (payload, ctx) => {
279 if (ctx.skipChecks) {

Callers 1

schemas.tsFile · 0.85

Calls 2

runChecksFunction · 0.85
parseMethod · 0.65

Tested by

no test coverage detected