10 lines
235 B
TypeScript
10 lines
235 B
TypeScript
export function isValidPhoneNumber(phone: string) {
|
|
return /^\+7\d{10}$/u.test(phone);
|
|
}
|
|
|
|
export function normalizePhoneNumber(phone: string): string {
|
|
const digitsOnly = phone.replaceAll(/\D/gu, '');
|
|
|
|
return `+${digitsOnly}`;
|
|
}
|