libphonenumber-js
Advanced tools
Comparing version 0.4.47 to 0.4.48
@@ -286,4 +286,16 @@ 'use strict'; | ||
var national_number = strip_national_prefix(number, country_metadata); | ||
var national_number = number; | ||
// Only strip national prefixes for non-international phone numbers | ||
// because national prefixes can't be present in international phone numbers. | ||
// Otherwise, while forgiving, it would parse a NANPA number `+1 1877 215 5230` | ||
// first to `1877 215 5230` and then, stripping the leading `1`, to `877 215 5230`, | ||
// and then it would assume that's a valid number which it isn't. | ||
// So no forgiveness for grandmas here. | ||
// The issue asking for this fix: | ||
// https://github.com/catamphetamine/libphonenumber-js/issues/159 | ||
if (!is_international) { | ||
national_number = strip_national_prefix(number, country_metadata); | ||
} | ||
var did_have_national_prefix = national_number !== number; | ||
@@ -290,0 +302,0 @@ |
@@ -261,4 +261,16 @@ import _getIterator from 'babel-runtime/core-js/get-iterator'; | ||
var national_number = strip_national_prefix(number, country_metadata); | ||
var national_number = number; | ||
// Only strip national prefixes for non-international phone numbers | ||
// because national prefixes can't be present in international phone numbers. | ||
// Otherwise, while forgiving, it would parse a NANPA number `+1 1877 215 5230` | ||
// first to `1877 215 5230` and then, stripping the leading `1`, to `877 215 5230`, | ||
// and then it would assume that's a valid number which it isn't. | ||
// So no forgiveness for grandmas here. | ||
// The issue asking for this fix: | ||
// https://github.com/catamphetamine/libphonenumber-js/issues/159 | ||
if (!is_international) { | ||
national_number = strip_national_prefix(number, country_metadata); | ||
} | ||
var did_have_national_prefix = national_number !== number; | ||
@@ -265,0 +277,0 @@ |
{ | ||
"name": "libphonenumber-js", | ||
"version": "0.4.47", | ||
"version": "0.4.48", | ||
"description": "A simpler (and smaller) rewrite of Google Android's popular libphonenumber library", | ||
@@ -5,0 +5,0 @@ "main": "index.common.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1491450
5989