Installations
npm install @fnando/cpf
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
12.16.1
NPM Version
6.13.4
Score
92.7
Supply Chain
96.1
Quality
75.5
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (57.8%)
JavaScript (42.2%)
Developer
fnando
Download Statistics
Total Downloads
3,125,459
Last Day
413
Last Week
8,188
Last Month
55,036
Last Year
685,862
GitHub Statistics
166 Stars
21 Commits
6 Forks
2 Watching
1 Branches
3 Contributors
Package Meta Information
Latest Version
1.0.2
Package Id
@fnando/cpf@1.0.2
Size
10.21 kB
NPM Version
6.13.4
Node Version
12.16.1
Publised On
21 Jul 2020
Total Downloads
Cumulative downloads
Total Downloads
3,125,459
Last day
-84.8%
413
Compared to previous day
Last week
-40.3%
8,188
Compared to previous week
Last month
-7.8%
55,036
Compared to previous month
Last year
11.6%
685,862
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
CPF
This package does some CPF magic. It allows you to create, validate and format CPF documents.
HINT: Check out the CNPJ counter part available at https://github.com/fnando/cnpj.
Installation
This lib is available as a NPM package. To install it, use the following command:
npm install @fnando/cpf --save
If you're using Yarn (and you should):
yarn add @fnando/cpf
Usage
1// Node.js-specific 2const cpf = require("@fnando/cpf/commonjs"); 3 4// @import 5import * as cpf from "@fnando/cpf"; // import the whole library 6import { isValid as isValidCpf } from "@fnando/cpf"; // import just one function 7 8// import via <script>; the lib will available as window.cpf 9// <script src="cpf.js"></script> 10 11cpf.isValid("532.820.857-96"); 12//=> true 13 14cpf.isValid("53282085796"); 15//=> true 16 17cpf.strip("532.820.857-96"); 18//=> 53282085796 19 20cpf.format("53282085796"); 21//=> 532.820.857-96 22 23cpf.generate(true); // generate formatted number 24//=> 838.684.734-40 25 26cpf.generate(); // generate unformatted number 27//=> 72777632898
On the web, without transformation, just use web/cpf.min.js
.
Strict Validation
By default, validations will strip any characters you provide. This means that the following is valid, because only numbers will be considered:
1cpf.isValid("101#688!!!!!!542......36"); 2//=> true 3 4cpf.strip("101#688!!!!!!542......36"); 5//=> 10168854236
If you want to strict validate strings, use the following signature:
1cpf.isValid(number, strict);
The same example would now return false
:
1cpf.isValid("101#688!!!!!!542......36", true); 2//=> false
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 2/19 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 4 are checked with a SAST tool
Score
3.2
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More