helix

2022-05-17T22:56:01.946989Z

I'm trying to port modulz design-system to cljs, and I'm using j/lit to brew js objects. I had an issue with a button that I suspect that has to do with order. Digging into I saw that the source object had all: 'unset'. I suspect that when I the object is tranformed into js the unpredictable order of clojure hash map is hitting me. So I ask: Does javascript respect the order of the keys in the Object ? It appears to do so. Object.keys shows the keys in the order of definition.

2022-05-18T10:51:29.045819Z

Now I'm using (jsvec-to-obj (j/lit ["all" "unset" ... and jsvec-to-obj instantiates a js object pairing the vec keys, I pay a hit at runtime, but the order is preserved and js can can apply its rules without being messed by the rules of the clojure map (j/lit {"all" "unset" ...

Jimmy Miller 2022-05-18T01:15:32.408709Z

Key order in js is a bit complicated. https://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order