0.0.0-dev • Published 3 years ago

@andrerds/cnpj-fork v0.0.0-dev

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

CNPJ

Consulta de CNPJ is Fork @rafaelrabaco

Installation

To install it, use the following command:

$ npm install --save andrerds/cnpj-fork

If you're using Yarn

$ yarn add andrerds/cnpj-fork

Usage

Consult

Returns the information of the CNPJ

import { CNPJ } from 'andrerds/cnpj-fork';

CNPJ.info('27865757000102')
  .then(response => {
    console.log(response);
  })
  .catch(err => {
    console.log(err);
  });

CNPJ.info('27.865.757/0001-02', {
    'token': 'TOKEN RECEITAWS' // Optional Pagando funciona com Api OFICIAL
    'timeout': 5000 // Optional (Default: 3000)
})
  .then(response => {
    console.log(response);
  })
  .catch(err => {
    console.log(err);
  });

Validate

Checks if it is a valid CNPJ

import { CNPJ } from 'andrerds/cnpj-fork';
CNPJ.validate('56.112.478/0001-68'); // true
CNPJ.validate('56112478000168'); // true
CNPJ.validate('12.033.793/0001-12'); // false
CNPJ.validate('12033793000112'); // false
CNPJ.validate('22.480.042/0001-00'); // true

Clean

Removes non-numeric characters.

import { CNPJ } from 'andrerds/cnpj-fork';
CNPJ.clear('43.236.279/0001-10'); // 43236279000110

Format

Add non-numeric characters.

import { CNPJ } from 'andrerds/cnpj-fork';
CNPJ.format('43236279000110'); // 43.236.279/0001-10
0.0.0-dev

3 years ago

1.0.0

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago