MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / numToString

Function numToString

pkg/vdom/vdom.go:472–501  ·  view source on GitHub ↗
(value T)

Source from the content-addressed store, hash-verified

470}
471
472func numToString[T any](value T) (string, bool) {
473 switch v := any(value).(type) {
474 case int:
475 return strconv.FormatInt(int64(v), 10), true
476 case int8:
477 return strconv.FormatInt(int64(v), 10), true
478 case int16:
479 return strconv.FormatInt(int64(v), 10), true
480 case int32:
481 return strconv.FormatInt(int64(v), 10), true
482 case int64:
483 return strconv.FormatInt(v, 10), true
484 case uint:
485 return strconv.FormatUint(uint64(v), 10), true
486 case uint8:
487 return strconv.FormatUint(uint64(v), 10), true
488 case uint16:
489 return strconv.FormatUint(uint64(v), 10), true
490 case uint32:
491 return strconv.FormatUint(uint64(v), 10), true
492 case uint64:
493 return strconv.FormatUint(v, 10), true
494 case float32:
495 return strconv.FormatFloat(float64(v), 'f', -1, 32), true
496 case float64:
497 return strconv.FormatFloat(v, 'f', -1, 64), true
498 default:
499 return "", false
500 }
501}
502
503func partToElems(part any) []VDomElem {
504 if part == nil {

Callers 1

partToElemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected