This file contains hidden or 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 camel-case-to-hyphenated | |
| "Converts a camel case string to a hyphenated string. | |
| E.g 'fooBar' -> 'foo-bar'" | |
| [s] | |
| (strs/join \- (drop-while empty? | |
| (map #(if (re-matches #"[^a-z]{2,}" %) % (strs/lower-case %)) | |
| (strs/split s #"(?=[A-Z][a-z])|(?<=[a-z])(?=[A-Z])"))))) |
This file contains hidden or 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
| (join \- (map #(if (re-matches #"[^a-z]{2,}" %) % (lower-case %))(split "fooBarQUXXX" #"(?=[A-Z][a-z])|(?<=[a-z])(?=[A-Z])"))) |