diff options
Diffstat (limited to 'src/dompa/nodes.cljc')
| -rw-r--r-- | src/dompa/nodes.cljc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/dompa/nodes.cljc b/src/dompa/nodes.cljc index 3e5c72f..d2f8e4b 100644 --- a/src/dompa/nodes.cljc +++ b/src/dompa/nodes.cljc @@ -132,18 +132,26 @@ attrs? (assoc :node/attrs attrs) (seq children) (assoc :node/children (flatten children)))))) +(defn- list-of-one? + [coll] + (and (sequential? coll) + (= (count coll) 1))) + +(defn- list-of-many? + [coll] + (and (sequential? coll) + (> (count coll) 1))) + (defn- nodes-from-opt [opt] (cond (map? opt) opt - (and (sequential? opt) - (> (count opt) 1)) + (list-of-many? opt) {:node/name :<> :node/children opt} - (and (sequential? opt) - (= (count opt) 1)) + (list-of-one? opt) (first opt) :else |
