Fork me on GitHub
#clojurescript
<
2023-02-03
>
Adrien Blavier10:02:19

Stupid question but how can I generate a keyless object in JS? Since all the interops require key value pairs? F.e. (def obj #js {:foo 1}) but I just want a {1} object?

magnars10:02:20

There are no {1} objects in JavaScript, since that doesn't make semantic sense. Are you looking for an array with the number 1 in it? #js [1] ? Or the number 1? 1

Adrien Blavier10:02:18

Ok googled around a bit and it seems that in ES6 {id} === {id: id} hence my confusion. I only used javascript a long time ago and didn’t know this existed

Adrien Blavier10:02:32

thanks for the help

👍 2
joshcho22:02:08

What is the best way to share a spec across CLJS frontend and CLJ backend? I am currently keeping them as separate projects, but I'd like suggestions on how to structure them as well.

p-himik22:02:57

In a .cljc file or files. Spec is available for both CLJ and CLJS, even the namespace is the same.

joshcho23:02:07

Do you keep both the frontend and backend in the same repository? Or do you manage the utility specs separately, and have them shared across

phill01:02:42

"shared across" would mean "in a third project, a library, referenced by the others through the usual orderly mechanism of referring to libraries". But you can certainly have cljs, clj, and cljc all in the same project. In that case, I like to keep them all together in 1 src tree because doing anything else is more difficult.

p-himik08:02:13

I definitely prefer storing everything in one project. Makes it so much easier to navigate.

agile_geek10:02:51

You could consider #C013B7MQHJQ for supporting a monorepo too.