google-libphonenumber
Advanced tools
+3
| const phoneUtil = require('.').PhoneNumberUtil.getInstance(); | ||
| console.log(phoneUtil.isValidNumberForRegion(phoneUtil.parse('7282031562', 'US'), 'US')); // =>> false |
+76
| // 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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
617844
0.45%8
33.33%2784
1.98%30
3.45%