( out: unknown )
| 365 | // names, and one more took a byte of the Valibot login form gzipped (its |
| 366 | // export `lo` became `co`), which holds no `~standard` at all |
| 367 | export const standardResultOf = ( |
| 368 | out: unknown |
| 369 | ): StandardSchemaV1.Result<unknown> => { |
| 370 | if (!(out instanceof ArkErrors)) return { value: out } |
| 371 | const issues = out.issues |
| 372 | return Object.defineProperty( |
| 373 | Object.defineProperty( |
| 374 | Object.defineProperty({ issues }, "_s", { |
| 375 | value: (json?: true) => |
| 376 | json ? |
| 377 | typeof (out as ArkErrors).toJSON === "function" ? |
| 378 | (out as ArkErrors).toJSON() |
| 379 | : (issues as SerializableIssues).toJSON!() |
| 380 | : (out as ArkErrors).summary, |
| 381 | writable: true |
| 382 | }), |
| 383 | "message", |
| 384 | failureMessage |
| 385 | ), |
| 386 | "toJSON", |
| 387 | failureToJson |
| 388 | ) |
| 389 | } |
| 390 | |
| 391 | // a validator bound to `context`, or itself when no callback in the bundle reads context |
| 392 | export const withContextOf = ( |
no test coverage detected