MCPcopy
hub / github.com/cortexlabs/cortex / JSONNumberToInt

Function JSONNumberToInt

pkg/lib/cast/interface.go:366–376  ·  view source on GitHub ↗
(in interface{})

Source from the content-addressed store, hash-verified

364}
365
366func JSONNumberToInt(in interface{}) (interface{}, bool) {
367 number, ok := in.(json.Number)
368 if !ok {
369 return in, true
370 }
371 inInt, err := number.Int64()
372 if err == nil {
373 return inInt, true
374 }
375 return nil, false
376}
377
378func JSONNumberToIntOrFloat(in interface{}) (interface{}, bool) {
379 number, ok := in.(json.Number)

Callers 5

InterfaceToInt8Function · 0.85
InterfaceToInt16Function · 0.85
InterfaceToInt32Function · 0.85
InterfaceToIntFunction · 0.85
InterfaceToInt64Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected