Skip to main content

index/functions/validateOptionalTokenName.md

validateOptionalTokenName(tokenName, field, constraint): void

Validates an optional token name (allows undefined/null, but validates if present)

Use this for optional token name fields that should be validated when provided.

Parameters​

ParameterTypeDescription
tokenNameunknownThe token name to validate (may be undefined/null)
fieldstringThe field name for error messages
constraintTokenNameConstraintThe route's token name constraint

Returns​

void

Throws​

If token name is provided but invalid

Since​

6.12.0