Brazil Utilities is a library that contains a set of functions to help you with the most common validations in Brazil.
To install the library you can use one of the following commands:
npm install brazil-utilities
or
yarn add brazil-utilities
To use one of our utilities you just need to import the required function as in the example below:
import { formatCPF } from 'brazil-utilities';
console.log(formatCPF('12345678900')) // Result: 123.456.789-00
This function formats a CPF number to the following format: 123.456.789-00
import { formatCPF } from 'brazil-utilities';
console.log(formatCPF('12345678900')) // Result: 123.456.789-00
This function formats a CNPJ number to the following format: 12.345.678/0001-00
import { formatCNPJ } from 'brazil-utilities';
console.log(formatCNPJ('12345678000100')) // Result: 12.345.678/0001-00
This function formats a CEP number to the following format: 12345-678
import { formatCEP } from 'brazil-utilities';
console.log(formatCEP('12345678')) // Result: 12345-678