(canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal)
| 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) { |
no test coverage detected