MCPcopy Create free account
hub / github.com/BishopFox/jsluice / AsArray

Method AsArray

tree.go:279–293  ·  view source on GitHub ↗

AsArray returns a representation of the Node as a []any

()

Source from the content-addressed store, hash-verified

277
278// AsArray returns a representation of the Node as a []any
279func (n *Node) AsArray() []any {
280 if n.Type() != "array" {
281 return []any{}
282 }
283
284 values := n.NamedChildren()
285
286 out := make([]any, 0, len(values))
287
288 for _, v := range values {
289 out = append(out, v.AsGoType())
290 }
291
292 return out
293}
294
295// AsNumber returns a representation of the Node as an int or float64.
296//

Callers 1

AsGoTypeMethod · 0.95

Calls 3

TypeMethod · 0.95
NamedChildrenMethod · 0.95
AsGoTypeMethod · 0.80

Tested by

no test coverage detected