This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-22
Channels
- # announcements (7)
- # beginners (10)
- # biff (2)
- # calva (12)
- # clerk (1)
- # clojure-europe (1)
- # clojure-korea (2)
- # clojure-norway (6)
- # cursive (5)
- # datahike (10)
- # datalevin (6)
- # datascript (2)
- # honeysql (18)
- # kaocha (1)
- # missionary (2)
- # off-topic (6)
- # pedestal (3)
- # ring (2)
- # shadow-cljs (11)
- # sql (2)
- # xtdb (4)
Hi everyone. I added some bug fixes and improvements to my tiny library https://github.com/roboli/balloon. Recursion is now exclusively used for inflating a map, not as before that it did a pre deflate on complex maps (yes, it kind of cheated). This will leave other parts of your map alone:
(def test-m {:value ["a" "b" "c"]
:other.0 "any"})
;; Before
(inflate test-m :hash-map true) ;;=> {:value {0 "a", 1 "b", 2 "c"}, :other {0 "any"}}
;; Now
(inflate test-m :hash-map true) ;;=> {:value ["a" "b" "c"], :other {0 "any"}}
You can now use the "/" as a delimiter:
(inflate {:user/id 1 :user/name "Sean" :user/address_id 2 :address/id 2} :delimiter "/")
;;=> {:user {:id 1, :name "Sean", :address_id 2}, :address {:id 2}}
And finally, the library is now Clojurescript compatible.
Things don't break until people start using them, so please give it go. Also, comments, suggestions and contributions are very welcome. Thanks.Nice lib! Does it work with ns-qualified keywords? I'm asking because it's fairly common for backends to work with ns-qualified keywords, and for a JS frontend to not want them, desiring nested objects instead. e.g. input:
{:my-map/one 1}
output:
{:my-map {:one 1}}
Yes it does @U45T93RA6, just pass in the :delimeter "/"
flag and it will treat the slash as a delimeter, not as a qualifier.
Neat - I should play with it for testing out some variations e.g. some.other/map
(. and /)