Created
November 16, 2017 15:49
-
-
Save pesterhazy/42c94768ed3dd991ea83ae96b4a6f57e to your computer and use it in GitHub Desktop.
clojurescript js-obj destructuring - thought experiment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; How about this syntax for JS object destructuring? | |
(require '[js.destructuring :as j]) | |
(j/let [^:js-obj {background-color "backgroundColor", :keys [color]} #js{:backgroundColor "red", :color "red"}] | |
(prn background-color color)) | |
;; or maybe... | |
(j/let [:js-obj {background-color "backgroundColor", :keys [color]} #js{:backgroundColor "red", :color "red"}] | |
(prn bakcground-color color)) | |
(j/defn myfn [:js-obj {:keys [foo bar]}] | |
(prn foo bar)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment