This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-12
Channels
- # announcements (1)
- # aws (1)
- # babashka (63)
- # beginners (108)
- # calva (12)
- # cider (6)
- # cljdoc (2)
- # cljsrn (33)
- # clojure (150)
- # clojure-europe (28)
- # clojure-nl (13)
- # clojure-spain (1)
- # clojure-spec (8)
- # clojure-uk (25)
- # clojurescript (16)
- # conjure (7)
- # cursive (7)
- # datomic (15)
- # duct (2)
- # eastwood (2)
- # figwheel (1)
- # figwheel-main (1)
- # fulcro (6)
- # graalvm (1)
- # graalvm-mobile (1)
- # helix (6)
- # honeysql (23)
- # integrant (6)
- # introduce-yourself (4)
- # jobs (10)
- # lsp (132)
- # malli (4)
- # meander (1)
- # membrane (1)
- # off-topic (223)
- # pathom (23)
- # pedestal (3)
- # re-frame (18)
- # reagent (13)
- # releases (1)
- # remote-jobs (2)
- # shadow-cljs (68)
- # tools-deps (217)
- # vim (19)
- # xtdb (79)
What's the best way to update the properties of a map entry? I've got a schema like [:map [:a :string] [:b :string]]
, and I want to transform it into something like [:map [:a :string] [:b {:my-date :foo} :string]]
.
mu/update-properties
only works for the :map
-level, so I tried combining it with mu/update
and giving a path into the map, but that also doesn't seem to be what I want. Is there a simpler way to achieve this that I'm overlooking?
You can walk the children or wait for https://github.com/metosin/malli/pull/466 to be merged
(defn map-children [f schema]
(m/-into-schema (m/-parent schema) (m/-properties schema) (map f children) (m/-options schema)))