Gathering detailed insights and metrics for yup-phone
Gathering detailed insights and metrics for yup-phone
Gathering detailed insights and metrics for yup-phone
Gathering detailed insights and metrics for yup-phone
npm install yup-phone
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
240 Stars
377 Commits
26 Forks
6 Watching
39 Branches
5 Contributors
Updated on 12 Sept 2024
Minified
Minified + Gzipped
TypeScript (50.48%)
JavaScript (49.52%)
Cumulative downloads
Total Downloads
Last day
2.3%
4,161
Compared to previous day
Last week
2%
20,812
Compared to previous week
Last month
7.7%
88,942
Compared to previous month
Last year
-38.6%
1,125,485
Compared to previous year
39
Adds a phone number validation check to yup validator using google-libphonenumber which gives accurate validation checks.
Read more about the core library here libphonenumber.
Read more about yup validator here yup
1# npm install --save yup-phone 2$ npm add yup-phone
Check validation in Codesandbox
1// See https://repl.it/repls/WiryCleverPatches 2import * as yup from 'yup'; 3// const yup = require("yup"); 4import "yup-phone"; 5// require("yup-phone"); 6 7// validate any phone number (defaults to India for country) 8const phoneSchema = yup.string() 9 .phone() 10 .required(); 11 12(async () => { 13 console.log(await phoneSchema.isValid("9876543210")); // → true 14})();
1// See https://repl.it/repls/SwiftImpossibleCertification 2import * as yup from 'yup'; 3// const yup = require("yup"); 4import "yup-phone"; 5// require("yup-phone"); 6 7// validate phone number loosely in the given region 8const phoneSchema = yup.string() 9 .phone("IN") 10 .required(); 11 12(async () => { 13 console.log(await phoneSchema.isValid('+919876543210')); // → true 14})();
1// See https://repl.it/repls/PartialAlicebluePrediction 2import * as yup from 'yup'; 3// const yup = require("yup"); 4import "yup-phone"; 5// require("yup-phone"); 6 7// validate phone number strictly in the given region 8const phoneSchema = yup.string() 9 .phone("IN", true) 10 .required(); 11 12console.log(phoneSchema.isValidSync("+919876543210")); // → true
1// See https://repl.it/repls/UniqueForsakenDownloads 2import * as yup from 'yup'; 3// const yup = require("yup"); 4import "yup-phone"; 5// require("yup-phone"); 6 7// validate phone number strictly in the given region with custom error message 8const phoneSchema = yup.string() 9 .phone('IN', true, '${path} is invalid') 10 .required(); 11 12try { 13 phoneSchema.validateSync('+1 345 9490088'); 14} catch (error) { 15 console.log(error.message); // → this is invalid 16}
For more examples, check yup-phone.test.ts file.
Destination: dist/yup-phone.umd.js
Bundle Size: 544.08 KB
Minified Size: 537.41 KB
Gzipped Size: 107.04 KB
Destination: dist/yup-phone.umd.min.js
Bundle Size: 508.65 KB
Minified Size: 506.46 KB
Gzipped Size: 105.73 KB
Destination: dist/yup-phone.esm.js
Bundle Size: 648 B
Minified Size: 646 B
Gzipped Size: 370 B
Destination: dist/yup-phone.cjs.js
Bundle Size: 1.35 KB
Minified Size: 1.34 KB
Gzipped Size: 662 B
npm version [major|minor|patch]
to version.npx cz
to create a standard commit interactively.1$ npm run build # Build for production 2$ npm test # Run tests 3$ npm publish # Publish npm package (prompts for version)
MIT.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 0/11 approved changesets -- score normalized to 0
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
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
28 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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