camel-snake-kebab
camel-snake-kebab copied to clipboard
Leading underscores and dashes not respected.
Any string that starts with an underscore or dash has the underscore or dash removed in the result.
ex: (->kebab-case "_my_string") => "my-string" (->kebab-case "-my-string") => "my-string"
ex of NullPointerException: (->kebab-case "-") =throws=> NullPointerException java.lang.NullPointerException (->kebab-case "_") =throws=> NullPointerException java.lang.NullPointerException
This is also true for any number of dashes or underscores: (->kebab-case "__----__----") =throws=> NullPointerException java.lang.NullPointerException
Also, empty strings throw the same exception: (csk/->kebab-case "") =throws=> NullPointerException java.lang.NullPointerException
Since they all send nil to clojure.string/lower-case instead of empty string or leaving the dashes and underscores intact
The exception issue is solved in master
.
A workaround for (->kebab-case "-my-string") => "my-string"
is to provide an extra :splitter \-
argument after I've merged #23.
Let me think a bit about what the default behavior should be…
What would you expect (->kebab-case "-_ f")
to return?
I suppose my expectation would be for it to honor all instances of the dash and replace all underscores with a dash and any number of consecutive whitespace with a single dash.
"-_ f" => "--f"
"---___ f" => "------f"
"___ f --- f" => "---f---f"
This should hold true for keywords as well.