( errors: ValidationResult<T>, )
| 71 | * @returns True if there are no errors |
| 72 | */ |
| 73 | export function isValidationClean<T extends Record<string, unknown>>( |
| 74 | errors: ValidationResult<T>, |
| 75 | ): boolean { |
| 76 | const keys = Object.keys(errors) as (keyof T)[]; |
| 77 | for (const key of keys) { |
| 78 | const value = errors[key]; |
| 79 | if (value === undefined || value === "") { |
| 80 | continue; |
| 81 | } |
| 82 | |
| 83 | if (typeof value === "string") { |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | for (const item of value) { |
| 88 | if (item !== undefined && item !== "") { |
| 89 | return false; |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | return true; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Create a debounced async validation runner. |
no test coverage detected