MCPcopy Create free account
hub / github.com/devspace-sh/devspace / typedVal

Function typedVal

pkg/util/strvals/strvals.go:453–484  ·  view source on GitHub ↗
(v []rune, st bool)

Source from the content-addressed store, hash-verified

451}
452
453func typedVal(v []rune, st bool) interface{} {
454 val := string(v)
455
456 if st {
457 return val
458 }
459
460 if strings.EqualFold(val, "true") {
461 return true
462 }
463
464 if strings.EqualFold(val, "false") {
465 return false
466 }
467
468 if strings.EqualFold(val, "null") {
469 return nil
470 }
471
472 if strings.EqualFold(val, "0") {
473 return int64(0)
474 }
475
476 // If this value does not start with zero, try parsing it to an int
477 if len(val) != 0 && val[0] != '0' {
478 if iv, err := strconv.ParseInt(val, 10, 64); err == nil {
479 return iv
480 }
481 }
482
483 return val
484}

Callers 1

newParserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected