SanitizeParameterName converts a parameter name to a safe JavaScript identifier by replacing non-alphanumeric characters with underscores. This function ensures that parameter names from workflows can be used safely in JavaScript code by: 1. Replacing any non-alphanumeric characters (except $ and _
(name string)
| 252 | // SanitizeParameterName("valid_name") // returns "valid_name" |
| 253 | // SanitizeParameterName("$special") // returns "$special" |
| 254 | func SanitizeParameterName(name string) string { |
| 255 | return SanitizeIdentifierName(name, func(r rune) bool { return r == '$' }) |
| 256 | } |
| 257 | |
| 258 | // SanitizePythonVariableName converts a parameter name to a valid Python identifier |
| 259 | // by replacing non-alphanumeric characters with underscores. |