MCPcopy
hub / github.com/tidwall/gjson / safeInt

Function safeInt

gjson.go:2807–2814  ·  view source on GitHub ↗

safeInt validates a given JSON number ensures it lies within the minimum and maximum representable JSON numbers

(f float64)

Source from the content-addressed store, hash-verified

2805// safeInt validates a given JSON number
2806// ensures it lies within the minimum and maximum representable JSON numbers
2807func safeInt(f float64) (n int64, ok bool) {
2808 // https://tc39.es/ecma262/#sec-number.min_safe_integer
2809 // https://tc39.es/ecma262/#sec-number.max_safe_integer
2810 if f < -9007199254740991 || f > 9007199254740991 {
2811 return 0, false
2812 }
2813 return int64(f), true
2814}
2815
2816// execStatic parses the path to find a static value.
2817// The input expects that the path already starts with a '!'

Callers 2

IntMethod · 0.85
UintMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…