Yet another where helper fix

Support nil conditions
This commit is contained in:
Sean Corfield 2020-10-12 18:37:28 -07:00
parent 96260901c2
commit febcf385ee

View file

@ -10,14 +10,19 @@
(defn- and-merge (defn- and-merge
[current args] [current args]
(cond (= :and (first current)) (let [args (remove nil? args)]
(default-merge current args) (cond (= :and (first current))
(seq current) (default-merge current args)
(default-merge [:and current] args) (seq current)
(= 1 (count args)) (if (seq args)
(vec (first args)) (default-merge [:and current] args)
:else current)
(default-merge [:and] args))) (= 1 (count args))
(vec (first args))
(seq args)
(default-merge [:and] args)
:else
(vec current))))
(def ^:private special-merges (def ^:private special-merges
{:where #'and-merge {:where #'and-merge