MCPcopy Create free account
hub / github.com/github/gh-aw / SanitizeParameterName

Function SanitizeParameterName

pkg/stringutil/sanitize.go:254–256  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

252// SanitizeParameterName("valid_name") // returns "valid_name"
253// SanitizeParameterName("$special") // returns "$special"
254func 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.

Calls 1

SanitizeIdentifierNameFunction · 0.85