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

awesome-phonenumber

Package Overview
Dependencies
Maintainers
1
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awesome-phonenumber

Google's libphonenumber pre-compiled with the closure compiler

  • 5.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
316K
decreased by-30.91%
Maintainers
1
Weekly downloads
 
Created

What is awesome-phonenumber?

The awesome-phonenumber npm package is a comprehensive library for parsing, formatting, and validating phone numbers. It supports a wide range of international phone number formats and provides utilities for handling phone number data effectively.

What are awesome-phonenumber's main functionalities?

Parsing Phone Numbers

This feature allows you to parse a phone number from a string and create a PhoneNumber object. The example demonstrates how to parse a US phone number.

const PhoneNumber = require('awesome-phonenumber');
const pn = new PhoneNumber('+12025550123');
console.log(pn.getNumber()); // Outputs: +12025550123

Formatting Phone Numbers

This feature allows you to format phone numbers in different formats such as E.164, international, and national. The example shows how to format a US phone number in various formats.

const PhoneNumber = require('awesome-phonenumber');
const pn = new PhoneNumber('+12025550123');
console.log(pn.getNumber('e164')); // Outputs: +12025550123
console.log(pn.getNumber('international')); // Outputs: +1 202-555-0123
console.log(pn.getNumber('national')); // Outputs: (202) 555-0123

Validating Phone Numbers

This feature allows you to validate whether a phone number is valid or not. The example demonstrates how to check the validity of a US phone number.

const PhoneNumber = require('awesome-phonenumber');
const pn = new PhoneNumber('+12025550123');
console.log(pn.isValid()); // Outputs: true

Getting Region Code

This feature allows you to get the region code of a phone number. The example shows how to retrieve the region code for a US phone number.

const PhoneNumber = require('awesome-phonenumber');
const pn = new PhoneNumber('+12025550123');
console.log(pn.getRegionCode()); // Outputs: US

Getting Country Code

This feature allows you to get the country code of a phone number. The example demonstrates how to retrieve the country code for a US phone number.

const PhoneNumber = require('awesome-phonenumber');
const pn = new PhoneNumber('+12025550123');
console.log(pn.getCountryCode()); // Outputs: 1

Other packages similar to awesome-phonenumber

Keywords

FAQs

Package last updated on 11 Feb 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