0.0.2 • Published 6 years ago
@fyne/yup-phone v0.0.2
yup-phone 
Adds a phone number validation check to yup validator using google-libphonenumber which gives accurate validation checks.
Read more here libphonenumber.
Install
# npm install --save yup-phone
$ yarn add yup-phoneUsage
const Yup = require('yup');
require('yup-phone');
// validate any phone number (defaults to India for country)
const phoneSchema = Yup.string().phone().required();
phoneSchema.isValid('9876543210'); // → trueconst Yup = require('yup');
require('yup-phone');
// validate phone number loosely in the given region
const phoneSchema = Yup.string().phone('IN').required();
phoneSchema.isValid('+919876543210'); // → trueconst Yup = require('yup');
require('yup-phone');
// validate phone number strictly in the given region
const phoneSchema = Yup.string().phone('IN', true).required();
phoneSchema.isValid('+919876543210'); // → trueFor more, check yup-phone.test.ts file.
Contributing
- Uses Rollup for bundling.
- Uses yarn for package management.
- Files are minified using closure compiler.
- Uses jest for testing.
- Generates CJS, UMD, and ESM builds.
- Use
yarn version --major|--minor|--patchto version. - Use tslint and prettier for code formatting.
- Uses semantic release for version.
- Use
yarn committo create a standard commit interactively.
$ yarn build # Build for production
$ yarn test # Run testsLicense
MIT.
0.0.2
6 years ago