UNPKG

1.28 kBTypeScriptView Raw
1import { ValidationOptions } from '../ValidationOptions';
2import { CountryCode } from 'libphonenumber-js';
3export declare const IS_PHONE_NUMBER = "isPhoneNumber";
4/**
5 * Checks if the string is a valid phone number. To successfully validate any phone number the text must include
6 * the intl. calling code, if the calling code wont be provided then the region must be set.
7 *
8 * @param value the potential phone number string to test
9 * @param region 2 characters uppercase country code (e.g. DE, US, CH) for country specific validation.
10 * If text doesn't start with the international calling code (e.g. +41), then you must set this parameter.
11 */
12export declare function isPhoneNumber(value: string, region?: CountryCode): boolean;
13/**
14 * Checks if the string is a valid phone number. To successfully validate any phone number the text must include
15 * the intl. calling code, if the calling code wont be provided then the region must be set.
16 *
17 * @param region 2 characters uppercase country code (e.g. DE, US, CH) for country specific validation.
18 * If text doesn't start with the international calling code (e.g. +41), then you must set this parameter.
19 */
20export declare function IsPhoneNumber(region?: CountryCode, validationOptions?: ValidationOptions): PropertyDecorator;