8000 JESI-2210 by AndreTheHunter · Pull Request #13 · jesims/backpack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JESI-2210 #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 3, 2018
Merged

JESI-2210 #13

merged 3 commits into from
Sep 3, 2018

Conversation

@@ -14,7 +15,8 @@
(defn js->clj
"Transforms JavaScript to ClojureScript converting keys to kebab-case keywords"
[x]
(transform-keys ->kebab-case-key (clojure.core/js->clj x :keywordize-keys true)))
(when-let [clj (some-> x (clojure.core/js->clj :keywordize-keys true))]
(transform-keys ->kebab-case-key clj)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight optimization to skip if nil

[x]
(js->clj (js/JSON.parse x)))
[s]
(when-not (string/blank? s)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blank is invalid JSON, so added check
Inspired by https://github.com/r0man/cljs-http/blob/master/src/cljs_http/util.cljs#L60

(assert-eq true "false")
(assert-eq "" "\"\"")
(assert-eq 3.14 "3.14")
(assert-eq 42 "42"))))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test all the things!

(assert-eq [] "[]")
(assert-eq nil "null")
(assert-eq true "true")
(assert-eq true "false")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ummm....dafaq?


(testing "parses empty and literal values"
(let [assert-eq (fn [expected s]
(is (= expected) (bp/json->clj s)))]
8000 Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paren mismatch

@axrs axrs assigned AndreTheHunter and unassigned axrs Sep 3, 2018
@AndreTheHunter AndreTheHunter assigned axrs and unassigned AndreTheHunter Sep 3, 2018
@axrs axrs merged commit 8c8abfb into master Sep 3, 2018
@axrs axrs deleted the JESI-2210 branch September 3, 2018 04:13
@AndreTheHunter AndreTheHunter mentioned this pull request Sep 4, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0