validation-docs-br
v2.1.1
Published
Brazilian documents validator
Downloads
63
Maintainers
Readme
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