BR Data Utils

Valida e formata dados brasileiros

Overview

This node, named 'BR Data Utils', is designed to validate and format Brazilian data such as CPF, CNPJ, phone numbers, and postal codes (CEP). Specifically, for the 'Validar CNPJ' operation, it validates a given CNPJ value to check if it is valid according to Brazilian standards. This node is useful in scenarios where data integrity and correctness of Brazilian identification numbers are critical, such as in financial, governmental, or business applications.

Use Case Examples

  1. Validating a CNPJ number entered by a user in a form to ensure it is correctly formatted and valid before processing.
  2. Checking a database of CNPJ numbers to filter out invalid entries.

Properties

Name Meaning
Valor The CNPJ value to be validated or formatted.

Output

JSON

  • operation - The operation performed, e.g., 'validarCnpj'.
  • original - The original input value provided for validation.
  • isValid - Boolean indicating whether the CNPJ is valid.
  • masked - The formatted (masked) version of the CNPJ if applicable.
  • unmasked - The unformatted (unmasked) version of the CNPJ if applicable.
  • error - Error message if validation failed or an unexpected error occurred.

Dependencies

  • The node depends on an internal validation utility module for executing the validation logic.

Troubleshooting

  • If the input value is not a valid CNPJ, the output will indicate 'isValid' as false and may include an error message describing the issue.
  • Unexpected errors during validation will be caught and reported in the 'error' field with a message starting with 'Erro inesperado'.
  • Ensure the input value is a string representing a CNPJ number; incorrect types or malformed strings may cause validation to fail.

Discussion