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

Function standardValidated

ark/type/runtime.ts:399–413  ·  view source on GitHub ↗
(
	validator: Validator,
	input: unknown,
	options: StandardSchemaV1.Options | undefined
)

Source from the content-addressed store, hash-verified

397
398// a validation Standard Schema asked for, in the context its options pass
399export const standardValidated = (
400 validator: Validator,
401 input: unknown,
402 options: StandardSchemaV1.Options | undefined
403): StandardSchemaV1.Result<unknown> => {
404 const context = readsContext ? options?.libraryOptions?.context : undefined
405 // Standard Schema returns its issues, so a configured onFail isn't called.
406 // Every validator with a ~standard takes a third argument, and one whose
407 // build configures no onFail ignores it
408 return standardResultOf(
409 readsContext && context !== undefined ?
410 inContext(context as never, () => validator(input, undefined, null))
411 : validator(input, undefined, null)
412 )
413}
414
415// shorter at each site than a literal
416export const siteOf = ((

Callers 1

standardOfFunction · 0.85

Calls 3

standardResultOfFunction · 0.85
inContextFunction · 0.50
validatorFunction · 0.50

Tested by

no test coverage detected