summaryrefslogtreecommitdiff
path: root/internal/node/array.go
blob: 780f99fbd8a066b305a6ceaffc87e31a0c5fb35b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package node

import "go.neonxp.dev/json"

func (n *Node) Append(v json.Node) {
	n.arrayValue = append(n.arrayValue, v.(*Node))
}

func (n *Node) Index(i int) json.Node {
	return n.arrayValue[i]
}

func (n *Node) SetByIndex(i int, v *Node) {
	n.arrayValue[i] = v
}

func (n *Node) RemoveByIndex(i int) {
	n.arrayValue = append(n.arrayValue[:i], n.arrayValue[i:]...)
}

func (n *Node) Len() int {
	return len(n.arrayValue)
}