0

It's possible to invoke a clojurescript function from javascript, for example:

cljs.core.keyword("foobar")

returns the :foobar keyword, positional arguments work as you would expect. I'm trying to invoke js->clj with the :keywordize-keys argument but so far I haven't been successful. I've tried:

cljs.core.js__GT_clj({'foo': 42}, {'keywordize-keys': true})

// and

var k = cljs.core.keyword('keywordize-keys')
cljs.core.js__GT_clj({'foo': 42}, {k: true})

but neither seem to work as I had hoped. In general how do you specify keyword arguments when calling from js into cljs?

1

1 Answer 1

2

In cljs you call the function like this:

(js->clj #js {"foo" 42} :keywordize-keys true)

And the corresponding js code:

var k = cljs.core.keyword('keywordize-keys')
cljs.core.js__GT_clj({'foo': 42}, k, true)
Sign up to request clarification or add additional context in comments.

Comments

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.