MCPcopy
hub / github.com/httprunner/httprunner / parseJSONNumber

Function parseJSONNumber

hrp/parser.go:144–157  ·  view source on GitHub ↗
(raw builtinJSON.Number)

Source from the content-addressed store, hash-verified

142}
143
144func parseJSONNumber(raw builtinJSON.Number) (value interface{}, err error) {
145 if strings.Contains(raw.String(), ".") {
146 // float64
147 value, err = raw.Float64()
148 } else {
149 // int64
150 value, err = raw.Int64()
151 }
152 if err != nil {
153 return nil, errors.Wrap(code.ParseError,
154 fmt.Sprintf("parse json number failed: %v", err))
155 }
156 return value, nil
157}
158
159const (
160 regexVariable = `[a-zA-Z_]\w*` // variable name should start with a letter or underscore

Callers 2

ParseMethod · 0.85
searchJmespathMethod · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected