Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/google-libphonenumber

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/google-libphonenumber

TypeScript definitions for google-libphonenumber

  • 7.4.30
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/google-libphonenumber?

@types/google-libphonenumber provides TypeScript type definitions for the google-libphonenumber library, which is a powerful library for parsing, formatting, and validating international phone numbers.

What are @types/google-libphonenumber's main functionalities?

Parsing Phone Numbers

This feature allows you to parse a phone number into a structured format. The code sample demonstrates how to parse a US phone number.

const libphonenumber = require('google-libphonenumber');
const phoneUtil = libphonenumber.PhoneNumberUtil.getInstance();
const number = phoneUtil.parseAndKeepRawInput('+14155552671', 'US');
console.log(number);

Formatting Phone Numbers

This feature allows you to format a parsed phone number into various formats such as international, national, E.164, etc. The code sample demonstrates formatting a US phone number into the international format.

const libphonenumber = require('google-libphonenumber');
const phoneUtil = libphonenumber.PhoneNumberUtil.getInstance();
const number = phoneUtil.parseAndKeepRawInput('+14155552671', 'US');
const formattedNumber = phoneUtil.format(number, libphonenumber.PhoneNumberFormat.INTERNATIONAL);
console.log(formattedNumber);

Validating Phone Numbers

This feature allows you to validate whether a phone number is valid for a given region. The code sample demonstrates validating a US phone number.

const libphonenumber = require('google-libphonenumber');
const phoneUtil = libphonenumber.PhoneNumberUtil.getInstance();
const number = phoneUtil.parseAndKeepRawInput('+14155552671', 'US');
const isValid = phoneUtil.isValidNumber(number);
console.log(isValid);

Other packages similar to @types/google-libphonenumber

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc