Fork me on GitHub
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?


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

👍 1

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.


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


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


"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.


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


You could consider #C013B7MQHJQ for supporting a monorepo too.