MCPcopy Create free account
hub / github.com/NoFxAiOS/nofx / parsePositiveInt

Function parsePositiveInt

api/handler_vergex.go:121–130  ·  view source on GitHub ↗
(raw string, fallback int)

Source from the content-addressed store, hash-verified

119}
120
121func parsePositiveInt(raw string, fallback int) int {
122 if raw == "" {
123 return fallback
124 }
125 var n int
126 if _, err := fmt.Sscanf(raw, "%d", &n); err != nil || n <= 0 {
127 return fallback
128 }
129 return n
130}
131
132func withDefault(value, fallback string) string {
133 if strings.TrimSpace(value) == "" {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected