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

libphonenumber-js

Package Overview
Dependencies
Maintainers
1
Versions
393
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript

  • 1.11.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.2M
decreased by-15.78%
Maintainers
1
Weekly downloads
 
Created

What is libphonenumber-js?

The libphonenumber-js npm package is a JavaScript library that provides a variety of functions for handling and manipulating phone numbers. It is based on Google's libphonenumber library and allows users to parse, format, and validate phone numbers in international formats.

What are libphonenumber-js's main functionalities?

Parsing and formatting phone numbers

This feature allows users to parse a string into a phone number object and format it into an international format.

import { parsePhoneNumberFromString } from 'libphonenumber-js';
const phoneNumber = parsePhoneNumberFromString('+12133734253');
console.log(phoneNumber.formatInternational()); // '+1 213 373 4253'

Validating phone numbers

This feature enables users to check if a given phone number is valid according to international standards.

import { isValidPhoneNumber } from 'libphonenumber-js';
const valid = isValidPhoneNumber('+12133734253');
console.log(valid); // true

Getting phone number information

This feature provides information about the phone number, such as the country it is associated with and the type of number (e.g., mobile, fixed-line).

import { parsePhoneNumberFromString } from 'libphonenumber-js';
const phoneNumber = parsePhoneNumberFromString('+12133734253');
console.log(phoneNumber.country); // 'US'
console.log(phoneNumber.getType()); // 'MOBILE'

Other packages similar to libphonenumber-js

Keywords

FAQs

Package last updated on 17 Oct 2024

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