summaryrefslogtreecommitdiff
path: root/src/dompa/nodes.cljc
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2026-01-10 14:44:59 +0200
committerAsko Nõmm <asko@nmm.ee>2026-01-10 14:44:59 +0200
commit3e4d870d6b287905c786174565a93fbd79bbb87c (patch)
tree1f10423c01193899e97e9f5afe130fd610aacf03 /src/dompa/nodes.cljc
parentbbad09960661f5b7a524301b7b61e8bd33aafce2 (diff)
Add empty-seq? function and update nodes-from-opt to handle empty sequences (#13)
Diffstat (limited to 'src/dompa/nodes.cljc')
-rw-r--r--src/dompa/nodes.cljc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dompa/nodes.cljc b/src/dompa/nodes.cljc
index d2f8e4b..eef65d3 100644
--- a/src/dompa/nodes.cljc
+++ b/src/dompa/nodes.cljc
@@ -142,11 +142,19 @@
(and (sequential? coll)
(> (count coll) 1)))
+(defn- empty-seq?
+ [coll]
+ (and (sequential? coll)
+ (empty? coll)))
+
(defn- nodes-from-opt
[opt]
(cond (map? opt)
opt
+ (empty-seq? opt)
+ nil
+
(list-of-many? opt)
{:node/name :<>
:node/children opt}