diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/vytree.ml | 4 | ||||
| -rw-r--r-- | src/vytree.mli | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/vytree.ml b/src/vytree.ml index 3177e24..ed5efd2 100644 --- a/src/vytree.ml +++ b/src/vytree.ml @@ -93,6 +93,10 @@ let rec get node path = | [name] -> find_or_fail node name | name :: names -> get (find_or_fail node name) names +let exists node path = + try ignore (get node path); true + with Nonexistent_path -> false + let get_existent_path node path = let rec aux node path acc = match path with diff --git a/src/vytree.mli b/src/vytree.mli index 4f57a0e..4b52727 100644 --- a/src/vytree.mli +++ b/src/vytree.mli @@ -30,3 +30,5 @@ val list_children : 'a t -> string list val get : 'a t -> string list -> 'a t val get_existent_path : 'a t -> string list -> string list + +val exists : 'a t -> string list -> bool |
