summaryrefslogtreecommitdiff
path: root/internal/node/array.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/node/array.go')
-rw-r--r--internal/node/array.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/node/array.go b/internal/node/array.go
new file mode 100644
index 0000000..780f99f
--- /dev/null
+++ b/internal/node/array.go
@@ -0,0 +1,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)
+}