summaryrefslogtreecommitdiff
path: root/internal/node/array.go
diff options
context:
space:
mode:
authorNeonXP <i@neonxp.dev>2023-01-04 18:44:58 +0300
committerNeonXP <i@neonxp.dev>2023-01-04 18:44:58 +0300
commit8716ac3e650075525cab7fb5caf1aa62b3efe55b (patch)
treef34dcb33400ef6bfd7f01b55a04f59784505c506 /internal/node/array.go
parente91712e388c530dd5bdfb46f028157a62a60b1e3 (diff)
rewriteHEADmaster
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)
+}