This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-04
Channels
- # announcements (13)
- # babashka (19)
- # beginners (74)
- # boot (1)
- # calva (5)
- # clj-kondo (22)
- # clojure (46)
- # clojure-android (3)
- # clojure-dev (4)
- # clojure-uk (69)
- # clojurescript (19)
- # community-development (17)
- # cursive (27)
- # datomic (9)
- # emacs (13)
- # graalvm (2)
- # instaparse (4)
- # luminus (1)
- # off-topic (21)
- # reagent (6)
- # remote-jobs (1)
- # ring-swagger (4)
- # test-check (49)
- # vrac (1)
If I have a js-object like (def x #js{"100" "a"})
is there a smart way to access the property "100"
? Normal property access with (.-100 x)
or (. x -100)
doesn’t seem to work. Do I have to use goog.object/get
?
How can I make this in cljs? Get matching group 1 with pattern ^.*(?:
(re-seq #"^.*(?:
gives invalid token error
I just want to extract youtube video id. Probably will need this cljs regex knowledge later too, so best to learn whats wrong with it
But even if you get it working, I would definitely follow Nate Sutton's advice and do this with a URL parser.
thx for suggestions but is this a bug with shadow-cljs?
This runs fine on js "
This gives invalid left hand side assign err (clojure.string/split "
?
What happens if you just try JS interop directly? That is one part of what clojure.string/split
should be calling
(.split "" #"(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)")
Looks like the above works on https://clojurescript.io/ I'd make sure that your testing clojure.string/split and the native JS split with the same javascript versions.
Interesting, Im using lein reframe
template which uses shadow-cljs: 2.8.83
and cljs: 1.10.597
both are seems to latest releases.
cljs.user=> (re-seq #"^.*(?: \w+/|embed/|v=)([^#&?]*).*" "v=hmOZU7Zk10")
(["v=hmOZU7Zk10" "hmOZU7Zk10"])
Careful with re-seq
and the caret character: https://ask.clojure.org/index.php/8329/caret-character-differences-with-re-seq-in-cljs-vs-clj