func entype()

in lib/xml/xml.go [240:271]


func entype(v any, t Type) any {
	switch v := v.(type) {
	case string:
		switch t {
		case BoolType:
			switch v {
			case "TRUE":
				return true
			case "FALSE":
				return false
			default:
				return v
			}
		case IntType:
			i, err := strconv.ParseInt(v, 10, 64)
			if err != nil {
				return v
			}
			return i
		case FloatType:
			f, err := strconv.ParseFloat(v, 64)
			if err != nil {
				return v
			}
			return f
		default:
			return v
		}
	default:
		return v
	}
}