Fork me on GitHub

Whats the Clojurescript equivalence of Javascript re.exec ? re-maches returns the string and captured group without name. Is there a way to get the captured group name and its value ? For example for regex "^/item/(?<itemid>[a-zA-Z0-9-]+?)$" I want to get the {:itemid 1} for string /item/1 .


Nothing built-in. You can just JS interop or some thirdparty library.


I have tried (.exe (RegExp. ...) too. It seems the value returned by .exe is a malformed Javascript Array. It has the value that looks something like this.

{0: <actual-str>, 1: <match-groups>, matches: {..}}
Now when this value is parsed by Clojurescript it thinks its an array and only returns [<actual-str>, <match-groups>]


It makes sense cos Array in Javascript is an Object whos keys are numbers.


It's not a malformed array. In JavaScript world, it's a proper array-like object with custom fields. Or something like that. Do not convert it to CLJS using js->clj. Just use interop: (.-matches result).


The matches themselves can be converted with js->clj if you really need it.


It worked. Thanks buddy

👍 3

What’s the best non-chrome browser for cljs development these days?


Given that most browsers are based on Chromium and generally provide only user-facing changes, I'm pretty sure that your only alternative is Firefox.


But its DevTools are not yet as extendable as Chrome's AFAIK.


Yeah, FF was on the verge of implementing the custom formatters, but it got squashed after downsizing 😞


Oh, that sucks, I didn't know about that.


Yeah, I was really excited about it, too. Was hoping to be mentored and help with the feature.


Would Safari be a huge step down for cljs dev? I’d like to commit to Safari or FF for an upcoming large project. Don’t want to re-learn tools in the middle of something big….


Seems Safari would be optimized for my mbp, which could be a good thing. And it’s WebKit.


I don't remember seeing anything good about WebKit that wouldn't also be true for Chrome/FF. But I remember quite a few instances were it didn't work as expected. Also not sure what "optimized" would mean here. If it work fast enough both for you and your users, then all is good.


I just hate Google and Chrome now. It’s totally irrational, but there it is.


I just want to support the alternatives.


‘optimized’ = runs better on the mac I’m developing on

Rico Meinl21:10:15

#shadow-cljs I’m importing a library via :require . Then after doing the shadow-cljs release to a node-library I get this error when importing it into the browser. Does anyone know why it doesnt resolve the require durin the build?


because as the name implies it is building a node-library. intended to run in node, not in the browser?