Function
validateStringParam
(
value: unknown,
paramName: string
)
Source from the content-addressed store, hash-verified
| 102 | * Consolidates parameter validation logic found across routes |
| 103 | */ |
| 104 | export function validateStringParam( |
| 105 | value: unknown, |
| 106 | paramName: string |
| 107 | ): { isValid: true } | { isValid: false; error: string } { |
| 108 | if (!value || typeof value !== 'string') { |
| 109 | return { |
| 110 | isValid: false, |
| 111 | error: `${paramName} is required and must be a string`, |
| 112 | } |
| 113 | } |
| 114 | return { isValid: true } |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Validate required fields in request body |
Tested by
no test coverage detected