MCPcopy Index your code
hub / github.com/ianstormtaylor/superstruct / validate

Method validate

src/struct.ts:107–116  ·  view source on GitHub ↗

* Validate a value with the struct's validation logic, returning a tuple * representing the result. * * You may optionally pass `true` for the `coerce` argument to coerce * the value before attempting to validate it. If you do, the result will * contain the coerced result when success

(
    value: unknown,
    options: {
      coerce?: boolean
      mask?: boolean
      message?: string
    } = {}
  )

Source from the content-addressed store, hash-verified

105 */
106
107 validate(
108 value: unknown,
109 options: {
110 coerce?: boolean
111 mask?: boolean
112 message?: string
113 } = {}
114 ): [StructError, undefined] | [undefined, T] {
115 return validate(value, this, options)
116 }
117}
118
119/**

Callers 2

validate.test.tsFile · 0.80
coercerFunction · 0.80

Calls 1

validateFunction · 0.85

Tested by

no test coverage detected