Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/phonenumber/index.d.ts>parsePhoneNumber

Google's libphonenumber pre-compiled with the closure compiler
Latest
function parsePhoneNumber
import { parsePhoneNumber } from "https://deno.land/x/phonenumber@v7.2.0/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.