mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-22 07:50:36 +01:00
refactor(Form): rename validation functions and vars for clarity (#3029)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -43,7 +43,7 @@ export function isStandardSchema(schema: any): schema is StandardSchemaV1 {
|
||||
return '~standard' in schema
|
||||
}
|
||||
|
||||
export async function validateStandarSchema(
|
||||
export async function validateStandardSchema(
|
||||
state: any,
|
||||
schema: StandardSchemaV1
|
||||
): Promise<ValidateReturnSchema<typeof state>> {
|
||||
@@ -192,7 +192,7 @@ async function validateValibotSchema(
|
||||
}
|
||||
}
|
||||
|
||||
export function parseSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>> {
|
||||
export function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>> {
|
||||
if (isZodSchema(schema)) {
|
||||
return validateZodSchema(state, schema)
|
||||
} else if (isJoiSchema(schema)) {
|
||||
@@ -204,7 +204,7 @@ export function parseSchema<T extends object>(state: T, schema: FormSchema<T>):
|
||||
} else if (isSuperStructSchema(schema)) {
|
||||
return validateSuperstructSchema(state, schema)
|
||||
} else if (isStandardSchema(schema)) {
|
||||
return validateStandarSchema(state, schema)
|
||||
return validateStandardSchema(state, schema)
|
||||
} else {
|
||||
throw new Error('Form validation failed: Unsupported form schema')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user