Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

yup phone number validation

// See https://repl.it/repls/PartialAlicebluePrediction
import * as yup from 'yup';
// const yup = require("yup");
import "yup-phone";
// require("yup-phone");

// validate phone number strictly in the given region
const phoneSchema = yup.string()
  .phone("IN", true)
  .required();

console.log(phoneSchema.isValidSync("+919876543210")); // → true
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #yup #phone #number #validation
ADD COMMENT
Topic
Name
2+7 =