MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / camelToSnake

Function camelToSnake

internal/mcp/scanner.go:100–113  ·  view source on GitHub ↗

camelToSnake converts MixedCase / camelCase to snake_case. ASCII only; proto method names never contain non-ASCII.

(s string)

Source from the content-addressed store, hash-verified

98// camelToSnake converts MixedCase / camelCase to snake_case. ASCII only;
99// proto method names never contain non-ASCII.
100func camelToSnake(s string) string {
101 var b strings.Builder
102 for i, r := range s {
103 if i > 0 && r >= 'A' && r <= 'Z' {
104 b.WriteByte('_')
105 }
106 if r >= 'A' && r <= 'Z' {
107 b.WriteRune(r + ('a' - 'A'))
108 } else {
109 b.WriteRune(r)
110 }
111 }
112 return b.String()
113}

Callers 1

ScanFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected