1.2.8 • Published 1 year ago

validate-documents v1.2.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Validate Documents

Run Tests Code Size Downloads LICENSE


Index


What is it?

This project, is a lib to validate oficial documents in Brazil. This validate CPF and CNPJ.


What technologies this project use?

  • Node.Js
    • TypeScript
    • Jest

How install it?

It's simple, just run the command in the terminal, example:

# Installing package

# Yarn
$ yarn add validate-documents

# npm
$ npm install validate-documents

Exemple of use:

Validate Documents

import { validateCpf } from 'validate-documents'

const isValidCpf = validateCpf('72994324040')

if(isValidCpf) {
    // Follow the flow with valid CPF, how create user
}else{
    // Follow the flow with invalid CPF, how return response with error and status code 400 
}

Create Fake Document Number

import { createFakeCpf } from 'validate-documents'

try {
    const cpfCreated = createFakeCpf()
    console.log('created CPF:', cpfCreated)
} catch (error) {
    console.error({
        error_name: error.name, // Error
        error_message: error.message, // Max retry to create fake cpf was hit
    })
}
Made with Love by Ramon Paolo Maram :3
1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago