trim
Removes whitespace from both ends of the string. The result goes to data.
Signature
ts
function trim(): Action<string>Notes
- Order matters: put
trim()before length checks. - A whitespace-only string becomes
''aftertrim(), but there is norequirederror — the emptiness check has already passed. AddminLength(1).
Example
Name
ts
pipe(string(), trim(), minLength(1, 'Please enter your name'))