🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

libphonenumber-node

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

libphonenumber-node

libphonenumber for node.js

0.0.3
latest
Source
npm
Version published
Weekly downloads
24
-47.83%
Maintainers
1
Weekly downloads
 
Created
Source

libphonenumber

Install

npm install libphonenumber-node

Use

var libphonenumber = require('libphonenumber-node');

// Human readable to E164. All of these will print +12125555555.
// The country code is necessary if our input has local numbers.
console.log(libphonenumber.format('212 555-5555', 'US'));
console.log(libphonenumber.format('(212) 555-5555', 'US'));
console.log(libphonenumber.format('212-555-5555', 'US'));
console.log(libphonenumber.format('+1 212-555-5555', 'US'));

// E164 to human readable.
console.log(libphonenumber.format('+12125555555', 'global')); // +1 212-555-5555
console.log(libphonenumber.format('+12125555555', 'local')); // (212) 555-5555
console.log(libphonenumber.format('+12125555555', 'url')); // tel:+1-212-555-5555
console.log(libphonenumber.format('+12125555555', 'e164')); // +12125555555

// Utility functions
console.log(libphonenumber.isValid('+12125555555')); // true
console.log(libphonenumber.isValid('foo')); // false
console.log(libphonenumber.getCountryCode('+12125555555')); // US
console.log(libphonenumber.getType('+12125555555')); // FIXED_LINE_OR_MOBILE

Update

Typing make should sync the code with the latest official libphonenumber.

Keywords

libphonenumber

FAQs

Package last updated on 19 May 2015

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