Don't add hyphens to upper-case strings
This commit is contained in:
@@ -13,9 +13,16 @@
|
|||||||
|
|
||||||
(def classes (-> "classes.edn" io/resource slurp edn/read-string))
|
(def classes (-> "classes.edn" io/resource slurp edn/read-string))
|
||||||
|
|
||||||
|
(defn split-string
|
||||||
|
[s]
|
||||||
|
(if (= s (string/upper-case s))
|
||||||
|
[s]
|
||||||
|
(string/split s #"(?=[A-Z])")))
|
||||||
|
|
||||||
(defn camel->keyword
|
(defn camel->keyword
|
||||||
[s]
|
[s]
|
||||||
(->> (string/split (string/replace s "_" "-") #"(?=[A-Z])")
|
(->> (string/replace s "_" "-")
|
||||||
|
split-string
|
||||||
(map string/lower-case)
|
(map string/lower-case)
|
||||||
(string/join "-")
|
(string/join "-")
|
||||||
keyword))
|
keyword))
|
||||||
|
|||||||
Reference in New Issue
Block a user