Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno_class_validator/src/index.ts>isPhoneNumber

Decorator-based property validation for classes.
Latest
function isPhoneNumber
import { isPhoneNumber } from "https://deno.land/x/deno_class_validator@v1.0.0/src/index.ts";

Checks if the string is a valid phone number. To successfully validate any phone number the text must include the intl. calling code, if the calling code wont be provided then the region must be set.

Parameters

value: string

the potential phone number string to test

optional
region: CountryCode

2 characters uppercase country code (e.g. DE, US, CH) for country specific validation. If text doesn't start with the international calling code (e.g. +41), then you must set this parameter.

Returns

boolean