Created
March 2, 2018 17:25
-
-
Save defndaines/3a5624dcaaa3cfd0ccbace26add533ad to your computer and use it in GitHub Desktop.
Converting snake_case to kebab-case and back again
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
(defn kebab-snake | |
"Convert a kebab-case keyword to snake_case." | |
[kw] | |
(-> kw name (clojure.string/replace #"-" "_") keyword)) | |
(defn snake-kebab | |
"Convert a snake_case keyword to kebab-case." | |
[kw] | |
(-> kw name (clojure.string/replace #"_" "-") keyword)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment