panzerdp / voca

The ultimate JavaScript string library
https://vocajs.pages.dev
MIT License
3.61k stars 136 forks source link

Voca's title case function is capitalizing some words it shouldn't #51

Open LandonSchropp opened 4 years ago

LandonSchropp commented 4 years ago

Expected behavior :smile_cat:

When title casing an abbreviation, Voca capitalizes some words it shouldn't, like to or a. I realize this can get pretty complicated or can vary between styles, but it seems to me that it still be helpful to have a function that followed the general rules.

voca.titleCase("bruce willis is a badass") // => "Bruce Willis is a Badass"

Actual behavior :crying_cat_face:

Voca capitalizes those words.

voca.titleCase("bruce willis is a badass") // => 'Bruce Willis Is A Badass'

Steps to reproduce :construction_worker:

Call the functions as described above.

Technical details: :wrench:

Browser/OS type: macOS 10.15.3 Node version: 13

panzerdp commented 4 years ago

Voca library isn't created specifically for English language, thus I cannot incorporate is or a into the function as a special case.

In the longterm, I plan to make some improvements to incorporate behavior by locale.