isStandardSchema<
Input = unknown,
Output = Input
>(schema: StandardSchemaV1<Input, Output>): schema | Name | Type | Description |
|---|---|---|
schema* | StandardSchemaV1<Input, Output> |
Type guard to check if a given value is a Standard Schema V1 object.
A Standard Schema object is expected to have a ~standard property with a validate function.
This guard does NOT check for JSON schema support.
The value to test.
if (isStandardSchema(mySchema)) {
const result = mySchema["~standard"].validate(input);
}