This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-22
Channels
- # announcements (5)
- # aws (38)
- # aws-lambda (21)
- # babashka (45)
- # beginners (87)
- # boot (1)
- # calva (32)
- # cider (23)
- # clara (7)
- # clj-kondo (41)
- # cljs-dev (29)
- # clojure (145)
- # clojure-europe (6)
- # clojure-italy (12)
- # clojure-nl (4)
- # clojure-spec (39)
- # clojure-uk (45)
- # clojurescript (171)
- # copenhagen-clojurians (4)
- # cursive (14)
- # datomic (48)
- # docker (6)
- # figwheel-main (2)
- # fulcro (54)
- # jackdaw (1)
- # jobs (1)
- # kaocha (3)
- # leiningen (7)
- # luminus (6)
- # malli (2)
- # off-topic (51)
- # pathom (8)
- # quil (20)
- # re-frame (14)
- # reagent (1)
- # reitit (2)
- # remote-jobs (1)
- # shadow-cljs (39)
- # tools-deps (1)
- # vim (12)
- # xtdb (5)
(js->clj {:a 1} :keywordize-keys symbol)
{:a 1}
Making :keywordize-keys
accept a function there seems an improvement. Open to patch?context:
#?(:cljs
(do (def fs (let [m (js->clj (js/require "fs"))]
(zipmap (map symbol (keys m)) (vals m))))
(deftest add-object-as-namespace
(is (str/includes?
(tu/eval* "(str (fs/readFileSync \"README.md\"))" {:namespaces {'fs fs}})
"EPL")))))
there is actually a ticket in CLJ for this
to break out the generic code here into a new more abstract function
or sorry I'm thinking of clojure.walk stuff
but same problem
@alexmiller for clojure.walk/keywordize-keys it's also a good idea
So do you not feel the name becomes wrong if you can configure it to arbitrary fn? I guess it could be just me being pedantic.
I was actually remembering that cheshire had the same name, but apparently it uses a positional parameter for it. So maybe a new option :key-fn
is less confusing
a new option is also less likely to break existing code. what if someone passed a function as a truthy value and didn't care what function it was
overall though, it does seem it could be useful to have the key fn be pluggable. however, is this already covered by this lib? https://github.com/mfikes/cljs-bean perhaps it is not pluggable there either (haven’t looked)
a lot of my open source coding experience is writing and rewriting various versions of js->clj
and clj->js
@dnolen FWIW, I think we should fix https://clojure.atlassian.net/browse/CLJS-3205 before applying too many other patches (flying blind a little now) I may take a crack at if if I get a little time soon