how do i use somestring.replace(regex, "_") in squint? My base question is how do i format the regex 😞
Hey! Are you aware of how to write a regex in Clojure?
#"foo" to easy -.-
i guess i was confuesed because of using .replace 😄 and thought i have to give it a js notation somehow
btw if i have a namespace and require squint compiler on the server side and than do a (let [something ...] the variable created contains the namespace is that correct behaviour? and can i disable it somehow
can you give a fuller example?
(ns test-tool.js-components
(:require [squint.compiler :as squint]))
(defn ->js [form]
(->>
(squint.compiler/compile-string* (str form))
:body))
(defn input [value]
(let [rand-id (str (int (rand 10000)))
el (->js `)
cleanup-input (->js `(let [el (js/document.getElementById ~rand-id)]
(->
el
.-value
(.replaceAll " " "_")
(.toLowerCase)
console.log)))]
[:input {:id rand-id :name "name" :value value :onkeyup cleanup-input}]))
This is because ` fully qualified symbols. You can avoid this by using a pound sign:
(->js `(let [el# ...] (-> el# ...))aaaaaaah
you are my hero @borkdude
:-D
this made my day