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). It is useful in scenarios where data integrity and formatting compliance with Brazilian standards are required, such as in customer data validation, form input verification, or data preprocessing for Brazilian databases. For example, it can validate if a CPF number is correctly formatted and valid, or check if a phone number meets Brazilian formatting rules.

Use Case Examples

  1. Validating a CPF number entered by a user to ensure it is valid before processing a transaction.
  2. Checking and formatting a Brazilian postal code (CEP) to standardize address data.
  3. Validating a Brazilian phone or mobile number to ensure it meets expected patterns.

Properties

Name Meaning
Valor The input value to be validated or formatted according to the selected operation.

Output

JSON

  • operation - The operation performed, e.g., 'validarCpf'.
  • original - The original input value provided for validation.
  • isValid - Boolean indicating if the input value is valid according to the operation.
  • masked - The formatted (masked) version of the input value if applicable, otherwise null.
  • unmasked - The unformatted (unmasked) version of the input value if applicable, otherwise null.
  • error - Error message if validation or formatting failed, otherwise null.

Dependencies

  • This node depends on an internal validation utility module for Brazilian data formats, which likely requires no external API but may require proper input formatting.

Troubleshooting

  • Common issues include invalid input formats that do not conform to Brazilian data standards, resulting in 'isValid' being false.
  • Unexpected errors during validation will return an error message in the output's 'error' field, which can help diagnose issues such as malformed input or internal processing errors.

Discussion