Review comment: move assoc-if to utils.
This commit is contained in:
parent
6fbd63fed2
commit
ae65ba14fb
2 changed files with 16 additions and 16 deletions
|
@ -40,19 +40,6 @@
|
|||
:db.install/_attribute :db.part/db}
|
||||
])
|
||||
|
||||
(defn assoc-if
|
||||
([m k v]
|
||||
(if v
|
||||
(assoc m k v)
|
||||
m))
|
||||
([m k v & kvs]
|
||||
(if kvs
|
||||
(let [[kk vv & remainder] kvs]
|
||||
(apply assoc-if
|
||||
(assoc-if m k v)
|
||||
kk vv remainder))
|
||||
(assoc-if m k v))))
|
||||
|
||||
|
||||
(defn- place->entity [[id rows]]
|
||||
(let [title (:title (first rows))
|
||||
|
@ -61,7 +48,7 @@
|
|||
:page/guid (:guid (first rows))}
|
||||
visits (keep :visit_date rows)]
|
||||
|
||||
(assoc-if required
|
||||
(util/assoc-if required
|
||||
:page/title title
|
||||
:page/visitAt visits)))
|
||||
|
||||
|
|
|
@ -73,6 +73,19 @@
|
|||
[m path v]
|
||||
(concat-in m path [v]))
|
||||
|
||||
(defn assoc-if
|
||||
([m k v]
|
||||
(if v
|
||||
(assoc m k v)
|
||||
m))
|
||||
([m k v & kvs]
|
||||
(if kvs
|
||||
(let [[kk vv & remainder] kvs]
|
||||
(apply assoc-if
|
||||
(assoc-if m k v)
|
||||
kk vv remainder))
|
||||
(assoc-if m k v))))
|
||||
|
||||
(defmacro while-let [binding & forms]
|
||||
`(loop []
|
||||
(when-let ~binding
|
||||
|
|
Loading…
Reference in a new issue