validation-docs-br
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

Brazilian documents validator

List of documents to make authentication

  • CPF (Cadastro de Pessoa Física)
  • CNPJ (Cadastro Nacional da Pessoa Jurídica)
  • PIS (Programa de Integração Social)

Install with NPM

$ npm i validation-docs-br

Install with YARN

$ yarn add validation-docs-br

Basic usage

Import file

import { AuthenticateDocs } from 'validation-docs-br';

or

const { AuthenticateDocs } = require('validation-docs-br');

Using authenticators

CPF

const authenticate = new AuthenticateDocs()
const result = authenticate.cpf({data: '123.456.789-10'})
// OR
const result = authenticate.cpf({data: 12345678910})

CNPJ

const authenticate = new AuthenticateDocs()
const result = authenticate.cnpj({data: '01.234.567/8910-11'})
// OR
const result = authenticate.cnpj({data: 01234567891011})

PIS

const authenticate = new AuthenticateDocs()
const result = authenticate.pis({data: '123.45678.91-0'})
// OR
const result = authenticate.pis({data: 12345678910})

Responses

In both cases the response is a boolean value.

  • true has mean that the document is valid

  • false has mean that the document is invalid

/validation-docs-br/

    Package Sidebar

    Install

    npm i validation-docs-br

    Weekly Downloads

    38

    Version

    2.1.1

    License

    ISC

    Unpacked Size

    83 kB

    Total Files

    50

    Last publish

    Collaborators

    • williamsouzaa