generatePositiveCheck()
generatePositiveCheck(
varName,ctx,customMessage?):CodeGenResult
Experimental
Generates inline code for the positive constraint (value > 0).
Parameters
varName: string
The variable name to check
ctx: GeneratorContext
The generator context
customMessage?: string
Optional custom error message
Returns: CodeGenResult
Generated code and updated context
Since
2.0.0
Example
const result = generatePositiveCheck("value", ctx);
// result.code = 'if (value <= 0) return "Number must be positive";'