0

I have a JavaScript array of JavaScript objects. I'd like to turn it into a vector of JavaScript objects. However, js->clj is recursive, such that the JavaScript objects themselves would be turned into CLJS maps.

How can I turn a JavaScript array into a CLJS vector without touching the elements inside the array?

1 Answer 1

3

(vec the-array) or (into [] the-array) will both turn the array into a vector and not touch the objects at all.

Sign up to request clarification or add additional context in comments.

2 Comments

Iff you know that the JavaScript array won't be modified, favor vec as it is faster.
Is there a similar way to shallowly convert objects to hash-maps?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.