MCPcopy
hub / github.com/julienschmidt/httprouter / countParams

Function countParams

tree.go:22–35  ·  tree.go::countParams
(path string)

Source from the content-addressed store, hash-verified

20const maxParamCount uint8 = ^uint8(0)
21
22func countParams(path string) uint8 {
23 var n uint
24 for i := 0; i < len(path); i++ {
25 if path[i] != ':' && path[i] != '*' {
26 continue
27 }
28 n++
29 }
30 if n >= uint(maxParamCount) {
31 return maxParamCount
32 }
33
34 return uint8(n)
35}
36
37type nodeType uint8
38

Callers 2

addRouteMethod · 0.85
TestCountParamsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestCountParamsFunction · 0.68