VitorLuizC / brazilian-values

🇧🇷 Funções de formatação, conversão e validação para valores, documentos e outras unidades usadas no Brasil. Como CEP, CNPJ, CPF, BRL (R$), datas, números etc.
MIT License
537 stars 38 forks source link

formatToCapitalized don't allow space-key? #38

Closed guitexa closed 3 years ago

guitexa commented 3 years ago

It's me again 😁

I'm trying to use formatToCapitalized function, but it's impossible to type space-key as you can see in this example on SandBox below:

https://codesandbox.io/s/keen-bose-k6y63

Thanks for helping 🙏🏼

VitorLuizC commented 3 years ago

Hmmm, i'm currently using String.prototype.trim to prevent trailling whitespaces. So, no it don't.

I'll add an option to disable this behavior

VitorLuizC commented 3 years ago

Fixed and published under version 0.8.0.

Now you can disable trim trailing white-spaces with trimTrailingWhiteSpaces: false.

formatToCapitalized(' com espaços antes e depois ', {
  trimTrailingWhiteSpaces: false
})
//=> ' Com Espaços Antes e Depois '
guitexa commented 3 years ago

Show man, it's worked fine, thanks! 🙏🏼