Title Case and Sentence Case do not preserve the new line character
Title Case and Sentence Case do not preserve the new line character.
This makes it impossible to process multiple sentences or paragraphs at once eg. if using the title-case package for <textarea>
If you’re using title case or sentence case from the change case library, it’s not designed for what you’re trying to do. Have you tried the title-case library directly? https://github.com/blakeembrey/change-case/tree/main/packages/change-case#built-in-methods
Change case assumes you are switching between different programming cases. It does not retain punctuation or other sensitivities.
@blakeembrey
I am using the title-case package https://www.npmjs.com/package/title-case
But titleCase(...) does not support new lines, it just trims them.
Got it, you're totally right. These two fixes should patch the issue: https://github.com/blakeembrey/change-case/commit/5a2c600beb3aa33b4d8c5288882bee3d6a16a539 and https://github.com/blakeembrey/change-case/commit/55a95d3968d7d3a1ca5a9ff6dba7c7172e1de546. Do you want to take a quick review and I'll release them if it makes sense to you?