wemake-services/recase

Removing punctuation

jhchen opened this issue · 1 comments

From the Wikipedia page linked from kebab_case.ex it says "As per snake_case above" and in the snake_case section above it says "Punctuation is removed and spaces are replaced..." However it looks like in this project's tests for kebab_case it seems to intentionally test for preservation of punctuation https://github.com/sobolevn/recase/blob/master/test/recase_test/kebab_case_test.exs#L18

My understanding of kebab case (and other cases) is that punctation should be removed and consecutive punctation is collapsed into one hyphen. This is for example what lodash does for their string conversion suite and this definition of kebab case seems supported by this project's own comment link to Wikipedia.

So for one I wanted to ask to clarify on what is the correct behavior. If punctuation should be preserved then the link to Wikipedia should be removed as it does not describe the functionality of the functions implemented by this project. If they should be removed then I'm happy to submit a PR changing this and updating the tests.

In case it is helpful the use case I have is generating urls for titles (user generated) and preserving punctation is of course problematic for urls.

@jhchen thanks for the detailed issue!
I guess you are right, it should be removed.

A PR with the fix will be an awesome contribution!