MCPcopy Create free account
hub / github.com/antchfx/xpath / asString

Function asString

func.go:248–270  ·  view source on GitHub ↗
(t iterator, v interface{})

Source from the content-addressed store, hash-verified

246}
247
248func asString(t iterator, v interface{}) string {
249 switch v := v.(type) {
250 case nil:
251 return ""
252 case bool:
253 if v {
254 return "true"
255 }
256 return "false"
257 case float64:
258 return strconv.FormatFloat(v, 'g', -1, 64)
259 case string:
260 return v
261 case query:
262 node := v.Select(t)
263 if node == nil {
264 return ""
265 }
266 return node.Value()
267 default:
268 panic(fmt.Errorf("unexpected type: %T", v))
269 }
270}
271
272// booleanFunc is a XPath functions boolean([node-set]).
273func booleanFunc(arg1 query) func(query, iterator) interface{} {

Callers 4

stringFuncFunction · 0.85
translateFuncFunction · 0.85
replaceFuncFunction · 0.85
lowerCaseFuncFunction · 0.85

Calls 2

SelectMethod · 0.65
ValueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…