mesqueeb / case-anything

camelCase, kebab-case, PascalCase... a simple integration with nano package size. (SMALL footprint!)
https://github.com/sponsors/mesqueeb
MIT License
99 stars 3 forks source link

Sentence case #25

Open souporserious opened 2 years ago

souporserious commented 2 years ago

Hello, thank you for this wonderful utility library! I was curious if you'd be willing to add a sentenceCase utility? I saw it was briefly considered in #10. I think this would be great for design systems that want to enforce this in UI elements like buttons. Happy to submit a PR if it sounds good 😊

cedeber commented 1 year ago

Same for titleCase, then 😊

mesqueeb commented 1 year ago

@souporserious @cedeber PRs welcome!

tommy-mitchell commented 10 months ago

The title-case package has a sentenceCase option (vs. a naive sentence case):

titleCase("hello there, world! I'm Tommy.", { sentenceCase: true })
//=> "Hello there, world! I'm Tommy."

naiveSentenceCase("hello there, world! I'm Tommy.")
//=> "Hello there, world! i'm tommy."

Should both be supported, or should sentenceCase be a wrapper around titleCase? i.e:

function sentenceCase(string, options) {
  return titleCase(string, { ...options, sentenceCase: true })
}

Perhaps a simple option could be added as well, for the naive output.