Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tratar CEP quando number e aceitar string | number #4

Open
wh1t3h47 opened this issue Nov 21, 2020 · 0 comments · Fixed by #3
Open

Tratar CEP quando number e aceitar string | number #4

wh1t3h47 opened this issue Nov 21, 2020 · 0 comments · Fixed by #3
Labels
enhancement New feature or request treat before publishing Do not publish on NPM before solving it

Comments

@wh1t3h47
Copy link
Owner

wh1t3h47 commented Nov 21, 2020

Qnd o cep tiver com o numero incorreto de digitos, vc add padding de zeros na frente dele ate completar o numero de digitos certo (dps de fazer strip do - ne), o CEP tem 8 numeros
Isso eh pq qnd o cep eh convertido pra int, ele perde os zeros de prefixo, faz sentido?
Ai vc aproveita tbm e no barcodeData aceita string| number, ai vc coloca letar maiuscula no parametro (pra nao precisar ficar substituindo as variaveis no codigo, mto chato isso), e passa a string de letra minuscula que a gnt usa ao redor do fluxo como String(Parametro), sendo Parametro do tipo string| number
O bom eh q a API fica mais flexivel assim, se o cara quiser passar cep como number, deixa, pq n?
Outra coisa q tem q fazer eh aceitar street number como string| number, seria bom usar um regex pra validar qnd for string, o cep ja ta sendo validado por regex, entao gg

@wh1t3h47 wh1t3h47 added enhancement New feature or request treat before publishing Do not publish on NPM before solving it labels Nov 21, 2020
@wh1t3h47 wh1t3h47 linked a pull request Nov 23, 2020 that will close this issue
@wh1t3h47 wh1t3h47 changed the title Tratar CEP erradao Tratar CEP quando number e aceitar string | number Nov 28, 2020
@wh1t3h47 wh1t3h47 reopened this Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request treat before publishing Do not publish on NPM before solving it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant