summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2016-12-25 12:06:30 +0700
committerDaniil Baturin <daniil@baturin.org>2016-12-25 12:06:30 +0700
commitbf0bb2d35b145fa6556993c2f745edfa73a977d7 (patch)
tree3d8d5e4ad813a3135e447054a7cbe31ee145d484
parented915d4cb4b4d9d6860f35b8b2853e066c9a2c0a (diff)
downloadvyconf-bf0bb2d35b145fa6556993c2f745edfa73a977d7.tar.gz
vyconf-bf0bb2d35b145fa6556993c2f745edfa73a977d7.zip
Add Vytree.children_of_path : 'a t -> string list function as a convenient shortcut for getting children of a non-root node
-rw-r--r--src/vytree.ml4
-rw-r--r--src/vytree.mli2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/vytree.ml b/src/vytree.ml
index 38f7570..0e379ee 100644
--- a/src/vytree.ml
+++ b/src/vytree.ml
@@ -123,3 +123,7 @@ let get_existent_path node path =
| None -> acc
| Some c -> aux c names (name :: acc)
in List.rev (aux node path [])
+
+let children_of_path node path =
+ let node' = get node path in
+ list_children node'
diff --git a/src/vytree.mli b/src/vytree.mli
index 4ba50ca..83a6096 100644
--- a/src/vytree.mli
+++ b/src/vytree.mli
@@ -34,3 +34,5 @@ val get_existent_path : 'a t -> string list -> string list
val get_data : 'a t -> string list -> 'a
val exists : 'a t -> string list -> bool
+
+val children_of_path : 'a t -> string list -> string list