diff options
| author | Asko Nõmm <asko@nmm.ee> | 2025-09-24 21:57:57 +0300 |
|---|---|---|
| committer | Asko Nõmm <asko@nmm.ee> | 2025-09-24 21:57:57 +0300 |
| commit | d98e13761fdcaa8cba912d367670855087b29c01 (patch) | |
| tree | 878ae923514b95168b6943be4a8ee7dbee1d81a6 /src/dompa/utils.cljc | |
| parent | 13f7093cfc9860dc2a9b2fd94f19d3661f15b3d3 (diff) | |
Improve $ macro clj-kondo hook, impl fragment node (well, not really a node itself, but any node with a name of :<> will replace itself with its children.
Diffstat (limited to 'src/dompa/utils.cljc')
| -rw-r--r-- | src/dompa/utils.cljc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/dompa/utils.cljc b/src/dompa/utils.cljc index 9e1cb27..0396e8a 100644 --- a/src/dompa/utils.cljc +++ b/src/dompa/utils.cljc @@ -12,12 +12,12 @@ (fn [rf] (letfn [(step [result input] (if (sequential? input) - (reduce step result input) ;; recursively reduce over nested seq - (rf result input)))] ;; apply rf with accumulator + value + (reduce step result input) + (rf result input)))] (fn - ([] (rf)) ;; init - ([result] (rf result)) ;; completion - ([result input] (step result input)))))) ;; step + ([] (rf)) + ([result] (rf result)) + ([result input] (step result input)))))) (defn ->flat [children] (into [] (->flat-xf) children)) @@ -39,9 +39,10 @@ (defhtml test-page [] (let [n 123] - ($ :div - ($ "hello world" n)) - ($ "hello") - ($ :div (map #(%) []) "test"))) + ($ :<> + ($ :div + ($ "hello world" n)) + ($ "hello") + ($ :div)))) (test-page) |
