Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
cpf_cnpj
Advanced tools
Readme
This package does some CPF/CNPJ magic. It allows you to create, validate and format CPF/CNPJ.
Using bower:
$ bower install cpf_cnpj --save
Using NPM:
$ npm install cpf_cnpj --save
// Node.js-specific
var CPF = require("cpf_cnpj").CPF;
var CNPJ = require("cpf_cnpj").CNPJ;
CPF.isValid("532.820.857-96");
//=> true
CPF.strip("532.820.857-96");
//=> 53282085796
CPF.format("53282085796");
//=> 532.820.857-96
CPF.generate(true); // generate formatted number
//=> 838.684.734-40
CPF.generate(); // generate unformatted number
//=> 72777632898
//==========================================================
CNPJ.isValid("41.381.074/6738-65");
//=> true
CNPJ.strip("41.381.074/6738-65");
//=> 41381074673865
CNPJ.format("41381074673865");
//=> 41.381.074/6738-65
CNPJ.generate(true); // generate formatted number
//=> 54.385.406/3140-07
CNPJ.generate(); // generate unformatted number
//=> 07033324230766
By default, validations will strip any characters you provide. This means that the following is valid, because only numbers will be considered:
CNPJ.isValid("41#381#074-----6738\n\n65");
//=> true
CNPJ.strip("41#381#074-----6738\n\n65");
//=> 41381074673865
If you want to strict validate strings, use the following signature:
CPF.isValid(number, strict);
CNPJ.isValid(number, strict);
The same example would now return false
:
CNPJ.isValid("41#381#074-----6738\n\n65", true);
//=> false
git checkout -b my-new-feature
)git commit -am "Added some feature"
)git push origin my-new-feature
)FAQs
Validate, generate and format CPF/CNPJ numbers
The npm package cpf_cnpj receives a total of 4,936 weekly downloads. As such, cpf_cnpj popularity was classified as popular.
We found that cpf_cnpj demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.