/** * * @param phoneNumber * @returns True if number that starts with "+" and contains a mix of digits and spaces with a configurable min length that defaults to 4. */ export const isValidPhoneNumber = (phoneNumber: string, minLength = 4) => /^\+[\d-\s]+$/.test(phoneNumber) && (phoneNumber.match(/\d+/g)?.join('').length ?? 0) >= minLength;