( value: string | string[] | undefined, maxLength?: number, )
| 15 | } |
| 16 | |
| 17 | const sanitizeParam = ( |
| 18 | value: string | string[] | undefined, |
| 19 | maxLength?: number, |
| 20 | ): string | undefined => { |
| 21 | const trimmed = getFirstQueryParam(value)?.trim(); |
| 22 | |
| 23 | if (!trimmed) { |
| 24 | return undefined; |
| 25 | } |
| 26 | |
| 27 | if (!maxLength) { |
| 28 | return trimmed; |
| 29 | } |
| 30 | |
| 31 | return trimmed.slice(0, maxLength); |
| 32 | }; |
| 33 | |
| 34 | const hasValue = (value?: string): boolean => !!value?.trim(); |
| 35 |
no test coverage detected