Function: validateUserInput()
validateUserInput(Defined in: sanitize.ts:315 Validates and sanitizes generic user input by trimming, removing HTML tags (unless allowed), normalizing whitespace, and removing dangerous patterns to prevent XSS and basic injection flaws.input,maxLength?,allowHtml?):string
Parameters
input
string
User input to validate and sanitize.
maxLength?
number = 500
Maximum allowed input length. Excess will be truncated.
allowHtml?
boolean = false
If true, HTML tags are preserved; otherwise, all tags are stripped.
Returns
string
Sanitized input string with length at most maxLength.