libphonenumber-js
Advanced tools
Comparing version 1.4.8 to 1.4.9
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.LEAD_CLASS = undefined; | ||
exports.LEAD_CLASS = exports.OPENING_PARENS = undefined; | ||
exports.default = isValidCandidate; | ||
@@ -16,3 +16,3 @@ | ||
var OPENING_PARENS = '(\\[\uFF08\uFF3B'; // Copy-pasted from `PhoneNumberMatcher.js`. | ||
var OPENING_PARENS = exports.OPENING_PARENS = '(\\[\uFF08\uFF3B'; // Copy-pasted from `PhoneNumberMatcher.js`. | ||
@@ -19,0 +19,0 @@ var CLOSING_PARENS = ')\\]\uFF09\uFF3D'; |
@@ -50,3 +50,3 @@ 'use strict'; | ||
var WHITESPACE_IN_THE_BEGINNING_PATTERN = new RegExp('^[' + _common.WHITESPACE + ']+'); | ||
var WHITESPACE_IN_THE_END_PATTERN = new RegExp('[' + _common.WHITESPACE + ']+$'); | ||
var WHITESPACE_AND_OPENING_PARENS_IN_THE_END_PATTERN = new RegExp('[' + _common.WHITESPACE + _isValidCandidate.OPENING_PARENS + ']+$'); | ||
@@ -146,3 +146,6 @@ // // Regular expression for getting opening brackets for a valid number | ||
startsAt += matches[0].length - number.length; | ||
number = number.replace(WHITESPACE_IN_THE_END_PATTERN, ''); | ||
// Fixes not parsing numbers with whitespace in the end. | ||
// Also fixes not parsing numbers with opening parentheses in the end. | ||
// https://github.com/catamphetamine/libphonenumber-js/issues/252 | ||
number = number.replace(WHITESPACE_AND_OPENING_PARENS_IN_THE_END_PATTERN, ''); | ||
@@ -149,0 +152,0 @@ number = (0, _parsePreCandidate2.default)(number); |
@@ -9,3 +9,3 @@ // Copy-pasted from `PhoneNumberMatcher.js`. | ||
var OPENING_PARENS = '(\\[\uFF08\uFF3B'; | ||
export var OPENING_PARENS = '(\\[\uFF08\uFF3B'; | ||
var CLOSING_PARENS = ')\\]\uFF09\uFF3D'; | ||
@@ -12,0 +12,0 @@ var NON_PARENS = '[^' + OPENING_PARENS + CLOSING_PARENS + ']'; |
@@ -12,9 +12,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import { PLUS_CHARS, VALID_PUNCTUATION, VALID_DIGITS, | ||
// OPENING_BRACKETS, | ||
WHITESPACE, create_extension_pattern } from './common'; | ||
import { PLUS_CHARS, VALID_PUNCTUATION, VALID_DIGITS, WHITESPACE, create_extension_pattern } from './common'; | ||
import parsePreCandidate from './findNumbers/parsePreCandidate'; | ||
import isValidPreCandidate from './findNumbers/isValidPreCandidate'; | ||
import isValidCandidate from './findNumbers/isValidCandidate'; | ||
import isValidCandidate, { OPENING_PARENS } from './findNumbers/isValidCandidate'; | ||
@@ -27,3 +25,3 @@ // Copy-pasted from `./parse.js`. | ||
var WHITESPACE_IN_THE_BEGINNING_PATTERN = new RegExp('^[' + WHITESPACE + ']+'); | ||
var WHITESPACE_IN_THE_END_PATTERN = new RegExp('[' + WHITESPACE + ']+$'); | ||
var WHITESPACE_AND_OPENING_PARENS_IN_THE_END_PATTERN = new RegExp('[' + WHITESPACE + OPENING_PARENS + ']+$'); | ||
@@ -122,3 +120,6 @@ // // Regular expression for getting opening brackets for a valid number | ||
startsAt += matches[0].length - number.length; | ||
number = number.replace(WHITESPACE_IN_THE_END_PATTERN, ''); | ||
// Fixes not parsing numbers with whitespace in the end. | ||
// Also fixes not parsing numbers with opening parentheses in the end. | ||
// https://github.com/catamphetamine/libphonenumber-js/issues/252 | ||
number = number.replace(WHITESPACE_AND_OPENING_PARENS_IN_THE_END_PATTERN, ''); | ||
@@ -125,0 +126,0 @@ number = parsePreCandidate(number); |
{ | ||
"name": "libphonenumber-js", | ||
"version": "1.4.8", | ||
"version": "1.4.9", | ||
"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 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
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 too big to display
Sorry, the diff of this file is too big to display
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
1759806
10236