Gathering detailed insights and metrics for @fnando/cpf
Gathering detailed insights and metrics for @fnando/cpf
Gathering detailed insights and metrics for @fnando/cpf
Gathering detailed insights and metrics for @fnando/cpf
npm install @fnando/cpf
Typescript
Module System
Node Version
NPM Version
92.7
Supply Chain
96.1
Quality
75.5
Maintenance
100
Vulnerability
100
License
TypeScript (57.8%)
JavaScript (42.2%)
Total Downloads
3,125,459
Last Day
413
Last Week
8,188
Last Month
55,036
Last Year
685,862
166 Stars
21 Commits
6 Forks
2 Watching
1 Branches
3 Contributors
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
Cumulative downloads
Total Downloads
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
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.
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
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
.
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
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
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
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