MCPcopy Create free account
hub / github.com/arktypeio/arktype / standardResultOf

Function standardResultOf

ark/type/runtime.ts:367–389  ·  view source on GitHub ↗
(
	out: unknown
)

Source from the content-addressed store, hash-verified

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
367export 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
392export const withContextOf = (

Callers 2

security.test.tsFile · 0.90
standardValidatedFunction · 0.85

Calls 1

toJSONMethod · 0.65

Tested by

no test coverage detected