panzerdp / voca

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

behave of camelCase with a number #15

Closed caoglish closed 7 years ago

caoglish commented 7 years ago

When camelCase with special characters, the characters will be removed.

But when I camelCase with a number, the number will not be removed and the letter next to the number will be capitalized. I am not sure the behave is correct or not.

version: 1.0.0

example:

v.camelCase("BIRD1FLIGHT")
//=> "bird1Flight"

v.camelCase("bird-1flight")
//=>"bird1Flight"

v.camelCase("bird-1flight-111-1--bi4rd 1flight")
//"bird1Flight1111Bi4Rd1Flight"
panzerdp commented 7 years ago

Yes, this is the intended behavior. Every series of consecutive numbers is considered a separated word.

v.camelCase('this is 2nd library version');
// => "thisIs2NdLibraryVersion"
v.camelCase('today is 20 December');
// => "todayIs20December"
caoglish commented 7 years ago

Thanks