feat: Make phone number input international & change library related

1. make phone number input international
2. change phone number library to libphonenumber

Change-Id: I25bb8006646d8f54b5e4bd0f84f713823f45ec5f
This commit is contained in:
zhuyue
2021-11-08 19:00:03 +08:00
parent 9d0e402048
commit 98cf22128f
14 changed files with 1247 additions and 19 deletions

View File

@@ -15,7 +15,7 @@
import { isString, isNil } from 'lodash';
import { Address4, Address6 } from 'ip-address';
import cidrRegex from 'cidr-regex';
import { phone } from 'phone';
import { isValidPhoneNumber } from 'libphonenumber-js';
const { v4, v6 } = cidrRegex;
@@ -75,7 +75,7 @@ export const regex = {
asciiRegex,
};
export const isPhoneNumber = (value) => phone(value).isValid;
export const isPhoneNumber = (value) => isValidPhoneNumber(value);
export const isEmailNumber = (value) => emailRegex.test(value);