Fork me on GitHub
Adam Helins14:01:34

Is there a way to detect in a macro whether the current compilation is advanced or not?


in regular CLJS you could check the compiler options I guess

Adam Helins14:01:05

@theller In CLJS I could rely on goog.DEBUG but here it is about a macro behaving differently if it is being used in the context of an advanced build


sorry by "regular CLJS" I meant not shadow-cljs 😉


:advanced is technically not part of the CLJS compilation and only done on the final JS as a separate step


so I don't know if the regular CLJS compiler sets anything you can check for this


the idea was that you can look at the compiler options via the cljs.env/*compiler* atom


shadow-cljs sets something in &env which you can check easily

(defmacro foo [bar]
  (if (= :release ( &env))

Adam Helins14:01:36

@thheller Excellent, both solutions are valid (checking &env and using cljs.env/*compiler)*

Adam Helins14:01:00

I'll use cljs.env as it is more general, thanks


Hi! I am stumped with a n00b question. I want to add functionality to a React Native component. I am using the PEZ repo as my starting point and need to make a TextInput component have the .focus() method called when the custom prop :focus is true. I am using React Native, Expo, Re-frame and Reagent. I am completely at a loss as to how to get my own text-input component from an existing React Native TextInput component. Thanks in advance for any guidance you can give me!

Felipe Marques20:01:09

Hi, guys, I'm trying to extend a type with a protocol and I'm having problem to find out which type to use. When I run (type my-obj) I get #object[LocalDate] is this the right way?


Hi there, I am new to Clojure I needed help converting js function to clojurescript . I have data coming from the API which is in PascalCased map key I am trying to get to readable state ex InventoryListNo ---> Inventory List No Since I am used to use to js this is what I have

function splitCamelCaseToString(s) {
    return s.split(/(?=[A-Z])/).join(' ');


output: "Hello World"
This is what I created in CLJS
(defn splitCamelCaseToString [s]
      (->> (str/split s #"(?=[A-Z])")
      (str/join s))) 
output: HelloHelloWorldWorld
Someone please tell me what am I doing wrong


You used s twice - you're joining ["Hello" "World"] using "HelloWorld" as a separator.


Ah I see thanks


(defn split-camel-case-to-string [s]
  (.join (.split s #"(?=[A-Z])") " "))


Thanks for your response I tried using this but I am getting empty return value


@singhamritpal49 This is the literal translation


To do it using functions in clojure.string


(defn split-camel-case-to-string [s]
  (str/join (str/split s #"(?=[A-Z])") " "))


The order of the arguments to str/join is incorrect. Same in the next code block.


and to use threading like you want


(defn split-camel-case-to-string [s]
  (-> s
      (str/split #"(?=[A-Z])")
      (str/join " ")))


(defn split-camel-case-to-string [s]
  (-> s
      (.split #"(?=[A-Z])")
      (.join " ")))