Aller au contenu principal

generateRegexCheck()

generateRegexCheck(varName, pattern, ctx, customMessage?): CodeGenResult

Experimental

Generates inline code for a custom regex constraint. Uses externals to reference the regex pattern directly.


Parameters

varName: string

The variable name to check.

pattern: RegExp

The regex pattern to match.

ctx: GeneratorContext

The generator context.

customMessage?: string

Optional custom error message.


Returns: CodeGenResult

Generated code and updated context.


Since

2.0.0