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

fix: 🐛 if a validator strategy returns two ways use the first #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

paulohenriquesn
Copy link

With this library, I encountered an issue where certain inputs, such as a CPF could also resemble a phone number. For instance:

CPF: 00000000000

The validator mistakenly returns: ['cpf', 'phone']

This situation poses a problem when attempting to normalize the input for a PIX transaction. For example:
normalize('000000000')
Without passing a strategy explicitly, the "as" parameter in the normalize method will be null, leading to a validation error.

The solution is to return the first strategy on validator to normalize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant