Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@aduh95/format-phone-number

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aduh95/format-phone-number

Simple JavaScript library that takes a phone number in the E164 format and returns it in an international format. It's using Google's [libphonenumber](https://github.com/google/libphonenumber) as a source of truth for how to format a phone number.

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

@aduh95/format-phone-number

Simple JavaScript library that takes a phone number in the E164 format and returns it in an international format. It's using Google's libphonenumber as a source of truth for how to format a phone number.

Usage

npm install @aduh95/format-phone-number

# or if you're using yarn
yarn add @aduh95/format-phone-number
import format from "@aduh95/format-phone-number";

await format("+16135991209"); // +1 613-599-1209

// You can omit the leading `+`
await format("16135991209"); // +1 613-599-1209

Ensure that the phone number is valid and includes the country code, otherwise you'll get undefined behavior.

Build

yarn install
yarn build
yarn test

Keywords

libphonenumber

FAQs

Package last updated on 28 May 2021

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