You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

google-libphonenumber

Package Overview
Dependencies
Maintainers
1
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-libphonenumber - npm Package Compare versions

Comparing version
3.2.43
to
3.2.44
+3
index.js
const phoneUtil = require('.').PhoneNumberUtil.getInstance();
console.log(phoneUtil.isValidNumberForRegion(phoneUtil.parse('7282031562', 'US'), 'US')); // =>> false
// Require `PhoneNumberFormat`.
const PNF = require('./dist/libphonenumber.js').PhoneNumberFormat;
// Get an instance of `PhoneNumberUtil`.
const phoneUtil = require('./dist/libphonenumber.js').PhoneNumberUtil.getInstance();
// Parse number with country code and keep raw input.
const number = phoneUtil.parseAndKeepRawInput('23407012341234', 'NG');
// Print the phone's country code.
console.log('Country Code', number.getCountryCode());
// => 1
// Print the phone's national number.
console.log('National Number', number.getNationalNumber());
// => 2024561414
// Print the phone's extension.
console.log(number.getExtension());
// =>
// Print the phone's extension when compared to i18n.phonenumbers.CountryCodeSource.
console.log(number.getCountryCodeSource());
// => FROM_DEFAULT_COUNTRY
// Print the phone's italian leading zero.
console.log(number.getItalianLeadingZero());
// => false
// Print the phone's raw input.
console.log(number.getRawInput());
// => 202-456-1414
// Result from isPossibleNumber().
console.log(phoneUtil.isPossibleNumber(number));
// => true
// Result from isValidNumber().
console.log(phoneUtil.isValidNumber(number));
// => true
// Result from isValidNumberForRegion().
console.log(phoneUtil.isValidNumberForRegion(number, 'US'));
// => true
// Result from getRegionCodeForNumber().
console.log(phoneUtil.getRegionCodeForNumber(number));
// => US
// Result from getNumberType() when compared to i18n.phonenumbers.PhoneNumberType.
console.log(phoneUtil.getNumberType(number));
// => FIXED_LINE_OR_MOBILE
// Format number in the E164 format.
console.log(phoneUtil.format(number, PNF.E164));
// => +12024561414
// Format number in the original format.
console.log(phoneUtil.formatInOriginalFormat(number, 'US'));
// => (202) 456-1414
// Format number in the national format.
console.log(phoneUtil.format(number, PNF.NATIONAL));
// => (202) 456-1414
// Format number in the international format.
console.log(phoneUtil.format(number, PNF.INTERNATIONAL));
// => +1 202-456-1414
// Format number in the out-of-country format from US.
console.log(phoneUtil.formatOutOfCountryCallingNumber(number, 'US'));
// => 1 (202) 456-1414
// Format number in the out-of-country format from CH.
console.log(phoneUtil.formatOutOfCountryCallingNumber(number, 'CH'));
// => 00 1 202-456-1414
+1
-1
{
"name": "google-libphonenumber",
"version": "3.2.43",
"version": "3.2.44",
"description": "The up-to-date and reliable Google's libphonenumber package for node.js.",

@@ -5,0 +5,0 @@ "author": {

Sorry, the diff of this file is too big to display