libphonenumber-js
Advanced tools
Comparing version 1.9.40 to 1.9.41
@@ -396,6 +396,18 @@ "use strict"; | ||
if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) { | ||
return new _AsYouTypeFormatter3["default"](leadingDigitsPattern).match(leadingDigits, { | ||
allowOverflow: true | ||
}) !== undefined; // Before leading digits < 3 matching was implemented: | ||
// Before leading digits < 3 matching was implemented: | ||
// return true | ||
// | ||
// After leading digits < 3 matching was implemented: | ||
try { | ||
return new _AsYouTypeFormatter3["default"](leadingDigitsPattern).match(leadingDigits, { | ||
allowOverflow: true | ||
}) !== undefined; | ||
} catch (error) { | ||
// There's a slight possibility that there could be some undiscovered bug | ||
// in the pattern matcher code. Since the "leading digits < 3 matching" | ||
// feature is not "essential" for operation, it can fall back to the old way | ||
// in case of any issues rather than halting the application's execution. | ||
console.error(error); | ||
return true; | ||
} | ||
} // If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are | ||
@@ -402,0 +414,0 @@ // available then use the usual regular expression matching. |
@@ -373,6 +373,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) { | ||
return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, { | ||
allowOverflow: true | ||
}) !== undefined; // Before leading digits < 3 matching was implemented: | ||
// Before leading digits < 3 matching was implemented: | ||
// return true | ||
// | ||
// After leading digits < 3 matching was implemented: | ||
try { | ||
return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, { | ||
allowOverflow: true | ||
}) !== undefined; | ||
} catch (error) { | ||
// There's a slight possibility that there could be some undiscovered bug | ||
// in the pattern matcher code. Since the "leading digits < 3 matching" | ||
// feature is not "essential" for operation, it can fall back to the old way | ||
// in case of any issues rather than halting the application's execution. | ||
console.error(error); | ||
return true; | ||
} | ||
} // If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are | ||
@@ -379,0 +391,0 @@ // available then use the usual regular expression matching. |
{ | ||
"name": "libphonenumber-js", | ||
"version": "1.9.40", | ||
"version": "1.9.41", | ||
"description": "A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.common.js", |
@@ -320,5 +320,16 @@ import { | ||
if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) { | ||
return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, { allowOverflow: true }) !== undefined | ||
// Before leading digits < 3 matching was implemented: | ||
// return true | ||
// | ||
// After leading digits < 3 matching was implemented: | ||
try { | ||
return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, { allowOverflow: true }) !== undefined | ||
} catch (error) { | ||
// There's a slight possibility that there could be some undiscovered bug | ||
// in the pattern matcher code. Since the "leading digits < 3 matching" | ||
// feature is not "essential" for operation, it can fall back to the old way | ||
// in case of any issues rather than halting the application's execution. | ||
console.error(error) | ||
return true | ||
} | ||
} | ||
@@ -325,0 +336,0 @@ |
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 too big to display
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 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
6671526
34261