mirror of
https://github.com/penpot/penpot.git
synced 2025-02-14 02:58:39 -05:00
✨ Improve kondo analyze function for db/with-atomic
Allow pass options as third argument on params vector
This commit is contained in:
parent
07562af677
commit
90f7e97d5b
1 changed files with 15 additions and 11 deletions
|
@ -41,18 +41,22 @@
|
||||||
|
|
||||||
(defn penpot-with-atomic
|
(defn penpot-with-atomic
|
||||||
[{:keys [node]}]
|
[{:keys [node]}]
|
||||||
(let [[_ params & other] (:children node)
|
(let [[params & body] (rest (:children node))]
|
||||||
|
(if (api/vector-node? params)
|
||||||
|
(let [[sym val opts] (:children params)]
|
||||||
|
(when-not (and sym val)
|
||||||
|
(throw (ex-info "No sym and val provided" {})))
|
||||||
|
{:node (api/list-node
|
||||||
|
(list*
|
||||||
|
(api/token-node 'let)
|
||||||
|
(api/vector-node [sym val])
|
||||||
|
opts
|
||||||
|
body))})
|
||||||
|
|
||||||
result (if (api/vector-node? params)
|
{:node (api/list-node
|
||||||
(api/list-node
|
(into [(api/token-node 'let)
|
||||||
(into [(api/token-node (symbol "clojure.core" "with-open")) params] other))
|
(api/vector-node [params params])]
|
||||||
(api/list-node
|
body))})))
|
||||||
(into [(api/token-node (symbol "clojure.core" "with-open"))
|
|
||||||
(api/vector-node [params params])]
|
|
||||||
other)))
|
|
||||||
|
|
||||||
]
|
|
||||||
{:node result}))
|
|
||||||
|
|
||||||
(defn penpot-defrecord
|
(defn penpot-defrecord
|
||||||
[{:keys [:node]}]
|
[{:keys [:node]}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue