AsArray returns a representation of the Node as a []any
()
| 277 | |
| 278 | // AsArray returns a representation of the Node as a []any |
| 279 | func (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 | // |
no test coverage detected