Skip to main content
Module

x/phonenumber/index.d.ts>parsePhoneNumber

Google's libphonenumber pre-compiled with the closure compiler
Go to Latest
function parsePhoneNumber
import { parsePhoneNumber } from "https://deno.land/x/phonenumber@v4.2.1/index.d.ts";

Parse a phone number into an object describing the number.

Examples

Example 1

  // Using a national phone number format
  parsePhoneNumber( '0707123456', { regionCode: 'SE' } )
  // Using an international (e164) phone number format
  parsePhoneNumber( '+46707123456' )

The options object is on the form:

{
  regionCode?: string;
}

Parameters

phoneNumber: string

Either an e164 formatted (international) phone number or a national phone number.

optional
options: PhoneNumberParseOptions

Object of type PhoneNumberParseOptions.