( result: ValidateResult, ref: Ref, type = 'validate', )
| 3 | import isString from '../utils/isString'; |
| 4 | |
| 5 | export default function getValidateError( |
| 6 | result: ValidateResult, |
| 7 | ref: Ref, |
| 8 | type = 'validate', |
| 9 | ): FieldError | void { |
| 10 | if ( |
| 11 | isString(result) || |
| 12 | (Array.isArray(result) && result.every(isString)) || |
| 13 | (isBoolean(result) && !result) |
| 14 | ) { |
| 15 | return { |
| 16 | type, |
| 17 | message: isString(result) ? result : '', |
| 18 | ref, |
| 19 | }; |
| 20 | } |
| 21 | } |
no outgoing calls
no test coverage detected