Skip to content

Latest commit

 

History

History
56 lines (34 loc) · 1.19 KB

README.md

File metadata and controls

56 lines (34 loc) · 1.19 KB

Brazil Utilities

Brazil Utilities is a library that contains a set of functions to help you with the most common validations in Brazil.

Installation

To install the library you can use one of the following commands:

npm install brazil-utilities

or 

yarn add brazil-utilities

Usage

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

Functions

formatCPF

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

formatCNPJ

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

formatCEP

This function formats a CEP number to the following format: 12345-678

import { formatCEP } from 'brazil-utilities';

console.log(formatCEP('12345678')) // Result: 12345-678