node-cnpj
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

CNPJ npm Downloads License

Funções utilitárias para tratamento de CNPJ.

Installation

npm install node-cnpj --save

Examples

Cnpj Validation

const cnpj = require('node-cnpj');

cnpj.validate('12.345.678/1234-56'); // returns TRUE
cnpj.validate('12345678123456');     // returns TRUE

cnpj.validate('11111111111'); // returns FALSE

CNPJ Mask

const cnpj = require('node-cnpj');

cnpj.mask('12345678123456'); // returns '12.345.678/1234-56'

CNPJ UnMask

const cnpj = require('node-cnpj');

cnpj.unMask('12.345.678/1234-56'); // returns '12345678123456'

CNPJ Is Masked

const cnpj = require('node-cnpj');

cnpj.isMasked('12.345.678/1234-56'); // returns TRUE
cnpj.isMasked('12345678123456');     // returns FALSE

Random CNPJ Generation

const cnpj = require('node-cnpj');

cnpj.generate();     // returns a valid CNPJ without mask
cnpj.generate(true); // returns a valid CNPJ with mask

Test and development

  • Install external dependencies: npm install
  • Run the test suite without coverage: npm test
  • Run the test suite with coverage: npm run testdox

How to Contribute

  • Open a pull request or an issue about what you want to implement / change. We're glad for any help!
  • Please be aware that we'll only accept fully tested code.

Contributors

LICENSE

Copyright (c) 2017-2023 Leonardo Thibes

The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.10
    48
    • latest

Version History

Package Sidebar

Install

npm i node-cnpj

Weekly Downloads

119

Version

1.0.10

License

MIT

Unpacked Size

19.1 kB

Total Files

16

Last publish

Collaborators

  • leonardothibes