@phonecheck/phone-number-validator-js 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/serverless.cjs.js +53 -36
- package/lib/serverless.esm.js +53 -36
- package/lib/serverless.esm.min.js +2 -2
- package/lib/serverless.umd.js +53 -36
- package/lib/serverless.umd.min.js +2 -2
- package/package.json +6 -6
package/lib/serverless.cjs.js
CHANGED
|
@@ -831,9 +831,9 @@ function matchesEntirely(text, regularExpressionText) {
|
|
|
831
831
|
return new RegExp('^(?:' + regularExpressionText + ')$').test(text);
|
|
832
832
|
}
|
|
833
833
|
|
|
834
|
-
function _createForOfIteratorHelperLoose$
|
|
835
|
-
function _unsupportedIterableToArray$
|
|
836
|
-
function _arrayLikeToArray$
|
|
834
|
+
function _createForOfIteratorHelperLoose$8(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$b(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
835
|
+
function _unsupportedIterableToArray$b(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$b(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$b(r, a) : void 0; } }
|
|
836
|
+
function _arrayLikeToArray$b(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
837
837
|
var NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL'];
|
|
838
838
|
|
|
839
839
|
// Finds out national phone number type (fixed line, mobile, etc)
|
|
@@ -889,7 +889,7 @@ function getNumberType$2(input, options, metadata) {
|
|
|
889
889
|
}
|
|
890
890
|
return 'FIXED_LINE';
|
|
891
891
|
}
|
|
892
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
892
|
+
for (var _iterator = _createForOfIteratorHelperLoose$8(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) {
|
|
893
893
|
var type = _step.value;
|
|
894
894
|
if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {
|
|
895
895
|
return type;
|
|
@@ -1152,9 +1152,9 @@ function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
|
|
|
1152
1152
|
};
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
|
-
function _createForOfIteratorHelperLoose$
|
|
1156
|
-
function _unsupportedIterableToArray$
|
|
1157
|
-
function _arrayLikeToArray$
|
|
1155
|
+
function _createForOfIteratorHelperLoose$7(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$a(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1156
|
+
function _unsupportedIterableToArray$a(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$a(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$a(r, a) : void 0; } }
|
|
1157
|
+
function _arrayLikeToArray$a(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1158
1158
|
|
|
1159
1159
|
// Returns the exact country that the `nationalPhoneNumber` belongs to
|
|
1160
1160
|
// in cases of ambiguity, i.e. when multiple countries share the same "country calling code".
|
|
@@ -1166,7 +1166,7 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
|
|
1166
1166
|
|
|
1167
1167
|
// const matchingCountries = []
|
|
1168
1168
|
|
|
1169
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
1169
|
+
for (var _iterator = _createForOfIteratorHelperLoose$7(countries), _step; !(_step = _iterator()).done;) {
|
|
1170
1170
|
var country = _step.value;
|
|
1171
1171
|
metadata.selectNumberingPlan(country);
|
|
1172
1172
|
// "Leading digits" patterns are only defined for about 20% of all countries.
|
|
@@ -1793,13 +1793,13 @@ function isViablePhoneNumberStart(number) {
|
|
|
1793
1793
|
return VALID_PHONE_NUMBER_START_REG_EXP.test(number);
|
|
1794
1794
|
}
|
|
1795
1795
|
|
|
1796
|
-
function _slicedToArray$3(r, e) { return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e) || _unsupportedIterableToArray$
|
|
1796
|
+
function _slicedToArray$3(r, e) { return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e) || _unsupportedIterableToArray$9(r, e) || _nonIterableRest$3(); }
|
|
1797
1797
|
function _nonIterableRest$3() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1798
1798
|
function _iterableToArrayLimit$3(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = true, o = false; try { if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = true, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
1799
1799
|
function _arrayWithHoles$3(r) { if (Array.isArray(r)) return r; }
|
|
1800
|
-
function _createForOfIteratorHelperLoose$
|
|
1801
|
-
function _unsupportedIterableToArray$
|
|
1802
|
-
function _arrayLikeToArray$
|
|
1800
|
+
function _createForOfIteratorHelperLoose$6(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$9(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1801
|
+
function _unsupportedIterableToArray$9(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$9(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$9(r, a) : void 0; } }
|
|
1802
|
+
function _arrayLikeToArray$9(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1803
1803
|
|
|
1804
1804
|
// https://www.ietf.org/rfc/rfc3966.txt
|
|
1805
1805
|
|
|
@@ -1813,7 +1813,7 @@ function parseRFC3966(text) {
|
|
|
1813
1813
|
|
|
1814
1814
|
// Replace "tel:" with "tel=" for parsing convenience.
|
|
1815
1815
|
text = text.replace(/^tel:/, 'tel=');
|
|
1816
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
1816
|
+
for (var _iterator = _createForOfIteratorHelperLoose$6(text.split(';')), _step; !(_step = _iterator()).done;) {
|
|
1817
1817
|
var part = _step.value;
|
|
1818
1818
|
var _part$split = part.split('='),
|
|
1819
1819
|
_part$split2 = _slicedToArray$3(_part$split, 2),
|
|
@@ -2298,9 +2298,9 @@ function extractExtension(number) {
|
|
|
2298
2298
|
}
|
|
2299
2299
|
}
|
|
2300
2300
|
|
|
2301
|
-
function _createForOfIteratorHelperLoose$
|
|
2302
|
-
function _unsupportedIterableToArray$
|
|
2303
|
-
function _arrayLikeToArray$
|
|
2301
|
+
function _createForOfIteratorHelperLoose$5(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$8(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2302
|
+
function _unsupportedIterableToArray$8(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$8(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$8(r, a) : void 0; } }
|
|
2303
|
+
function _arrayLikeToArray$8(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2304
2304
|
// These mappings map a character (key) to a specific digit that should
|
|
2305
2305
|
// replace it for normalization purposes. Non-European digits that
|
|
2306
2306
|
// may be used in phone numbers are mapped to a European equivalent.
|
|
@@ -2403,7 +2403,7 @@ function parseDigits(string) {
|
|
|
2403
2403
|
// (the ones consisting of four bytes) but digits
|
|
2404
2404
|
// (including non-European ones) don't fall into that range
|
|
2405
2405
|
// so such "exotic" characters would be discarded anyway.
|
|
2406
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
2406
|
+
for (var _iterator = _createForOfIteratorHelperLoose$5(string.split('')), _step; !(_step = _iterator()).done;) {
|
|
2407
2407
|
var character = _step.value;
|
|
2408
2408
|
var digit = parseDigit(character);
|
|
2409
2409
|
if (digit) {
|
|
@@ -2413,9 +2413,9 @@ function parseDigits(string) {
|
|
|
2413
2413
|
return result;
|
|
2414
2414
|
}
|
|
2415
2415
|
|
|
2416
|
-
function _createForOfIteratorHelperLoose$
|
|
2417
|
-
function _unsupportedIterableToArray$
|
|
2418
|
-
function _arrayLikeToArray$
|
|
2416
|
+
function _createForOfIteratorHelperLoose$4(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$7(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2417
|
+
function _unsupportedIterableToArray$7(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$7(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$7(r, a) : void 0; } }
|
|
2418
|
+
function _arrayLikeToArray$7(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2419
2419
|
|
|
2420
2420
|
/**
|
|
2421
2421
|
* Parses phone number characters from a string.
|
|
@@ -2440,7 +2440,7 @@ function parseIncompletePhoneNumber(string) {
|
|
|
2440
2440
|
// (the ones consisting of four bytes) but digits
|
|
2441
2441
|
// (including non-European ones) don't fall into that range
|
|
2442
2442
|
// so such "exotic" characters would be discarded anyway.
|
|
2443
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
2443
|
+
for (var _iterator = _createForOfIteratorHelperLoose$4(string.split('')), _step; !(_step = _iterator()).done;) {
|
|
2444
2444
|
var character = _step.value;
|
|
2445
2445
|
result += parsePhoneNumberCharacter(character, result) || '';
|
|
2446
2446
|
}
|
|
@@ -2956,10 +2956,10 @@ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
2956
2956
|
function _defineProperty$7(e, r, t) { return (r = _toPropertyKey$h(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
|
|
2957
2957
|
function _toPropertyKey$h(t) { var i = _toPrimitive$h(t, "string"); return "symbol" == _typeof$h(i) ? i : i + ""; }
|
|
2958
2958
|
function _toPrimitive$h(t, r) { if ("object" != _typeof$h(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof$h(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2959
|
-
function _slicedToArray$2(r, e) { return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$
|
|
2959
|
+
function _slicedToArray$2(r, e) { return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$6(r, e) || _nonIterableRest$2(); }
|
|
2960
2960
|
function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2961
|
-
function _unsupportedIterableToArray$
|
|
2962
|
-
function _arrayLikeToArray$
|
|
2961
|
+
function _unsupportedIterableToArray$6(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$6(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$6(r, a) : void 0; } }
|
|
2962
|
+
function _arrayLikeToArray$6(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2963
2963
|
function _iterableToArrayLimit$2(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = true, o = false; try { if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = true, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
2964
2964
|
function _arrayWithHoles$2(r) { if (Array.isArray(r)) return r; }
|
|
2965
2965
|
|
|
@@ -3698,6 +3698,9 @@ function isValidCandidate(candidate, offset, text, leniency) {
|
|
|
3698
3698
|
}
|
|
3699
3699
|
|
|
3700
3700
|
function _typeof$a(o) { "@babel/helpers - typeof"; return _typeof$a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$a(o); }
|
|
3701
|
+
function _createForOfIteratorHelperLoose$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$5(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3702
|
+
function _unsupportedIterableToArray$5(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$5(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$5(r, a) : void 0; } }
|
|
3703
|
+
function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
3701
3704
|
function _classCallCheck$7(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3702
3705
|
function _defineProperties$7(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$a(o.key), o); } }
|
|
3703
3706
|
function _createClass$7(e, r, t) { return r && _defineProperties$7(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e; }
|
|
@@ -3717,7 +3720,7 @@ var EXTN_PATTERNS_FOR_MATCHING = createExtensionPattern();
|
|
|
3717
3720
|
*/
|
|
3718
3721
|
var INNER_MATCHES = [
|
|
3719
3722
|
// Breaks on the slash - e.g. "651-234-2345/332-445-1234"
|
|
3720
|
-
'
|
|
3723
|
+
'/+(.*)',
|
|
3721
3724
|
// Note that the bracket here is inside the capturing group, since we consider it part of the
|
|
3722
3725
|
// phone number. Will match a pattern like "(650) 223 3345 (754) 223 3321".
|
|
3723
3726
|
'(\\([^(]*)', // Breaks on a hyphen - e.g. "12345 - 332-445-1234 is my number."
|
|
@@ -3837,7 +3840,12 @@ var PhoneNumberMatcher$1 = /*#__PURE__*/function () {
|
|
|
3837
3840
|
|
|
3838
3841
|
/** The maximum number of retries after matching an invalid number. */
|
|
3839
3842
|
this.maxTries = options.maxTries;
|
|
3843
|
+
|
|
3844
|
+
// Compile regular expressions.
|
|
3840
3845
|
this.PATTERN = new RegExp(PATTERN, 'ig');
|
|
3846
|
+
this.INNER_MATCHES = INNER_MATCHES.map(function (pattern) {
|
|
3847
|
+
return new RegExp(pattern, 'g');
|
|
3848
|
+
});
|
|
3841
3849
|
|
|
3842
3850
|
/** The iteration tristate. */
|
|
3843
3851
|
this.state = 'NOT_READY';
|
|
@@ -3861,10 +3869,9 @@ var PhoneNumberMatcher$1 = /*#__PURE__*/function () {
|
|
|
3861
3869
|
*/
|
|
3862
3870
|
return _createClass$7(PhoneNumberMatcher, [{
|
|
3863
3871
|
key: "find",
|
|
3864
|
-
value: function find() {
|
|
3865
|
-
//
|
|
3866
|
-
|
|
3867
|
-
|
|
3872
|
+
value: function find(index) {
|
|
3873
|
+
// Reset the regular expression.
|
|
3874
|
+
this.PATTERN.lastIndex = index;
|
|
3868
3875
|
var matches;
|
|
3869
3876
|
while (this.maxTries > 0 && (matches = this.PATTERN.exec(this.text)) !== null) {
|
|
3870
3877
|
var candidate = matches[0];
|
|
@@ -3917,11 +3924,12 @@ var PhoneNumberMatcher$1 = /*#__PURE__*/function () {
|
|
|
3917
3924
|
}, {
|
|
3918
3925
|
key: "extractInnerMatch",
|
|
3919
3926
|
value: function extractInnerMatch(substring, offset, text) {
|
|
3920
|
-
for (var
|
|
3921
|
-
var
|
|
3927
|
+
for (var _iterator = _createForOfIteratorHelperLoose$3(this.INNER_MATCHES), _step; !(_step = _iterator()).done;) {
|
|
3928
|
+
var innerMatchRegExp = _step.value;
|
|
3929
|
+
// Reset regular expression.
|
|
3930
|
+
innerMatchRegExp.lastIndex = 0;
|
|
3922
3931
|
var isFirstMatch = true;
|
|
3923
3932
|
var candidateMatch = void 0;
|
|
3924
|
-
var innerMatchRegExp = new RegExp(innerMatchPattern, 'g');
|
|
3925
3933
|
while (this.maxTries > 0 && (candidateMatch = innerMatchRegExp.exec(substring)) !== null) {
|
|
3926
3934
|
if (isFirstMatch) {
|
|
3927
3935
|
// We should handle any group before this one too.
|
|
@@ -3993,10 +4001,9 @@ var PhoneNumberMatcher$1 = /*#__PURE__*/function () {
|
|
|
3993
4001
|
key: "hasNext",
|
|
3994
4002
|
value: function hasNext() {
|
|
3995
4003
|
if (this.state === 'NOT_READY') {
|
|
3996
|
-
this.lastMatch = this.find(
|
|
3997
|
-
|
|
4004
|
+
this.lastMatch = this.find(this.searchIndex);
|
|
3998
4005
|
if (this.lastMatch) {
|
|
3999
|
-
|
|
4006
|
+
this.searchIndex = this.lastMatch.endsAt;
|
|
4000
4007
|
this.state = 'READY';
|
|
4001
4008
|
} else {
|
|
4002
4009
|
this.state = 'DONE';
|
|
@@ -6598,7 +6605,17 @@ function formatIncompletePhoneNumber() {
|
|
|
6598
6605
|
function PhoneNumber(number) {
|
|
6599
6606
|
return PhoneNumber$1.call(this, number, metadata)
|
|
6600
6607
|
}
|
|
6601
|
-
PhoneNumber.prototype
|
|
6608
|
+
// Setting `PhoneNumber.prototype` via `Object.create()`
|
|
6609
|
+
// didn't work with `instanceof` operator for some strange reason.
|
|
6610
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/201
|
|
6611
|
+
// Because of that issue, the `Object.create()` call had to be removed.
|
|
6612
|
+
// It didn't result in any drawbacks because the `{}` argument of that call
|
|
6613
|
+
// means that the `PhoneNumber` class created here adds 0 new properties
|
|
6614
|
+
// to the existing `PhoneNumber` class it attempts to extend here.
|
|
6615
|
+
// Hence, the `Object.create()` call can be omitted
|
|
6616
|
+
// and the `prototype` can just be copied over as is.
|
|
6617
|
+
// PhoneNumber.prototype = Object.create(_PhoneNumber.prototype, {})
|
|
6618
|
+
PhoneNumber.prototype = PhoneNumber$1.prototype;
|
|
6602
6619
|
PhoneNumber.prototype.constructor = PhoneNumber;
|
|
6603
6620
|
|
|
6604
6621
|
function parseNumber() {
|
package/lib/serverless.esm.js
CHANGED
|
@@ -829,9 +829,9 @@ function matchesEntirely(text, regularExpressionText) {
|
|
|
829
829
|
return new RegExp('^(?:' + regularExpressionText + ')$').test(text);
|
|
830
830
|
}
|
|
831
831
|
|
|
832
|
-
function _createForOfIteratorHelperLoose$
|
|
833
|
-
function _unsupportedIterableToArray$
|
|
834
|
-
function _arrayLikeToArray$
|
|
832
|
+
function _createForOfIteratorHelperLoose$8(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$b(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
833
|
+
function _unsupportedIterableToArray$b(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$b(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$b(r, a) : void 0; } }
|
|
834
|
+
function _arrayLikeToArray$b(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
835
835
|
var NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL'];
|
|
836
836
|
|
|
837
837
|
// Finds out national phone number type (fixed line, mobile, etc)
|
|
@@ -887,7 +887,7 @@ function getNumberType$2(input, options, metadata) {
|
|
|
887
887
|
}
|
|
888
888
|
return 'FIXED_LINE';
|
|
889
889
|
}
|
|
890
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
890
|
+
for (var _iterator = _createForOfIteratorHelperLoose$8(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) {
|
|
891
891
|
var type = _step.value;
|
|
892
892
|
if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {
|
|
893
893
|
return type;
|
|
@@ -1150,9 +1150,9 @@ function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
|
|
|
1150
1150
|
};
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
function _createForOfIteratorHelperLoose$
|
|
1154
|
-
function _unsupportedIterableToArray$
|
|
1155
|
-
function _arrayLikeToArray$
|
|
1153
|
+
function _createForOfIteratorHelperLoose$7(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$a(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1154
|
+
function _unsupportedIterableToArray$a(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$a(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$a(r, a) : void 0; } }
|
|
1155
|
+
function _arrayLikeToArray$a(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1156
1156
|
|
|
1157
1157
|
// Returns the exact country that the `nationalPhoneNumber` belongs to
|
|
1158
1158
|
// in cases of ambiguity, i.e. when multiple countries share the same "country calling code".
|
|
@@ -1164,7 +1164,7 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
|
|
1164
1164
|
|
|
1165
1165
|
// const matchingCountries = []
|
|
1166
1166
|
|
|
1167
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
1167
|
+
for (var _iterator = _createForOfIteratorHelperLoose$7(countries), _step; !(_step = _iterator()).done;) {
|
|
1168
1168
|
var country = _step.value;
|
|
1169
1169
|
metadata.selectNumberingPlan(country);
|
|
1170
1170
|
// "Leading digits" patterns are only defined for about 20% of all countries.
|
|
@@ -1791,13 +1791,13 @@ function isViablePhoneNumberStart(number) {
|
|
|
1791
1791
|
return VALID_PHONE_NUMBER_START_REG_EXP.test(number);
|
|
1792
1792
|
}
|
|
1793
1793
|
|
|
1794
|
-
function _slicedToArray$3(r, e) { return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e) || _unsupportedIterableToArray$
|
|
1794
|
+
function _slicedToArray$3(r, e) { return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e) || _unsupportedIterableToArray$9(r, e) || _nonIterableRest$3(); }
|
|
1795
1795
|
function _nonIterableRest$3() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1796
1796
|
function _iterableToArrayLimit$3(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = true, o = false; try { if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = true, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
1797
1797
|
function _arrayWithHoles$3(r) { if (Array.isArray(r)) return r; }
|
|
1798
|
-
function _createForOfIteratorHelperLoose$
|
|
1799
|
-
function _unsupportedIterableToArray$
|
|
1800
|
-
function _arrayLikeToArray$
|
|
1798
|
+
function _createForOfIteratorHelperLoose$6(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$9(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1799
|
+
function _unsupportedIterableToArray$9(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$9(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$9(r, a) : void 0; } }
|
|
1800
|
+
function _arrayLikeToArray$9(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1801
1801
|
|
|
1802
1802
|
// https://www.ietf.org/rfc/rfc3966.txt
|
|
1803
1803
|
|
|
@@ -1811,7 +1811,7 @@ function parseRFC3966(text) {
|
|
|
1811
1811
|
|
|
1812
1812
|
// Replace "tel:" with "tel=" for parsing convenience.
|
|
1813
1813
|
text = text.replace(/^tel:/, 'tel=');
|
|
1814
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
1814
|
+
for (var _iterator = _createForOfIteratorHelperLoose$6(text.split(';')), _step; !(_step = _iterator()).done;) {
|
|
1815
1815
|
var part = _step.value;
|
|
1816
1816
|
var _part$split = part.split('='),
|
|
1817
1817
|
_part$split2 = _slicedToArray$3(_part$split, 2),
|
|
@@ -2296,9 +2296,9 @@ function extractExtension(number) {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
}
|
|
2298
2298
|
|
|
2299
|
-
function _createForOfIteratorHelperLoose$
|
|
2300
|
-
function _unsupportedIterableToArray$
|
|
2301
|
-
function _arrayLikeToArray$
|
|
2299
|
+
function _createForOfIteratorHelperLoose$5(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$8(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2300
|
+
function _unsupportedIterableToArray$8(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$8(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$8(r, a) : void 0; } }
|
|
2301
|
+
function _arrayLikeToArray$8(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2302
2302
|
// These mappings map a character (key) to a specific digit that should
|
|
2303
2303
|
// replace it for normalization purposes. Non-European digits that
|
|
2304
2304
|
// may be used in phone numbers are mapped to a European equivalent.
|
|
@@ -2401,7 +2401,7 @@ function parseDigits(string) {
|
|
|
2401
2401
|
// (the ones consisting of four bytes) but digits
|
|
2402
2402
|
// (including non-European ones) don't fall into that range
|
|
2403
2403
|
// so such "exotic" characters would be discarded anyway.
|
|
2404
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
2404
|
+
for (var _iterator = _createForOfIteratorHelperLoose$5(string.split('')), _step; !(_step = _iterator()).done;) {
|
|
2405
2405
|
var character = _step.value;
|
|
2406
2406
|
var digit = parseDigit(character);
|
|
2407
2407
|
if (digit) {
|
|
@@ -2411,9 +2411,9 @@ function parseDigits(string) {
|
|
|
2411
2411
|
return result;
|
|
2412
2412
|
}
|
|
2413
2413
|
|
|
2414
|
-
function _createForOfIteratorHelperLoose$
|
|
2415
|
-
function _unsupportedIterableToArray$
|
|
2416
|
-
function _arrayLikeToArray$
|
|
2414
|
+
function _createForOfIteratorHelperLoose$4(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$7(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2415
|
+
function _unsupportedIterableToArray$7(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$7(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$7(r, a) : void 0; } }
|
|
2416
|
+
function _arrayLikeToArray$7(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2417
2417
|
|
|
2418
2418
|
/**
|
|
2419
2419
|
* Parses phone number characters from a string.
|
|
@@ -2438,7 +2438,7 @@ function parseIncompletePhoneNumber(string) {
|
|
|
2438
2438
|
// (the ones consisting of four bytes) but digits
|
|
2439
2439
|
// (including non-European ones) don't fall into that range
|
|
2440
2440
|
// so such "exotic" characters would be discarded anyway.
|
|
2441
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
2441
|
+
for (var _iterator = _createForOfIteratorHelperLoose$4(string.split('')), _step; !(_step = _iterator()).done;) {
|
|
2442
2442
|
var character = _step.value;
|
|
2443
2443
|
result += parsePhoneNumberCharacter(character, result) || '';
|
|
2444
2444
|
}
|
|
@@ -2954,10 +2954,10 @@ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
2954
2954
|
function _defineProperty$7(e, r, t) { return (r = _toPropertyKey$h(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
|
|
2955
2955
|
function _toPropertyKey$h(t) { var i = _toPrimitive$h(t, "string"); return "symbol" == _typeof$h(i) ? i : i + ""; }
|
|
2956
2956
|
function _toPrimitive$h(t, r) { if ("object" != _typeof$h(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof$h(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2957
|
-
function _slicedToArray$2(r, e) { return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$
|
|
2957
|
+
function _slicedToArray$2(r, e) { return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$6(r, e) || _nonIterableRest$2(); }
|
|
2958
2958
|
function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2959
|
-
function _unsupportedIterableToArray$
|
|
2960
|
-
function _arrayLikeToArray$
|
|
2959
|
+
function _unsupportedIterableToArray$6(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$6(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$6(r, a) : void 0; } }
|
|
2960
|
+
function _arrayLikeToArray$6(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2961
2961
|
function _iterableToArrayLimit$2(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = true, o = false; try { if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = true, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
2962
2962
|
function _arrayWithHoles$2(r) { if (Array.isArray(r)) return r; }
|
|
2963
2963
|
|
|
@@ -3696,6 +3696,9 @@ function isValidCandidate(candidate, offset, text, leniency) {
|
|
|
3696
3696
|
}
|
|
3697
3697
|
|
|
3698
3698
|
function _typeof$a(o) { "@babel/helpers - typeof"; return _typeof$a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$a(o); }
|
|
3699
|
+
function _createForOfIteratorHelperLoose$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$5(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: true } : { done: false, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3700
|
+
function _unsupportedIterableToArray$5(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$5(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$5(r, a) : void 0; } }
|
|
3701
|
+
function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
3699
3702
|
function _classCallCheck$7(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3700
3703
|
function _defineProperties$7(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$a(o.key), o); } }
|
|
3701
3704
|
function _createClass$7(e, r, t) { return r && _defineProperties$7(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e; }
|
|
@@ -3715,7 +3718,7 @@ var EXTN_PATTERNS_FOR_MATCHING = createExtensionPattern();
|
|
|
3715
3718
|
*/
|
|
3716
3719
|
var INNER_MATCHES = [
|
|
3717
3720
|
// Breaks on the slash - e.g. "651-234-2345/332-445-1234"
|
|
3718
|
-
'
|
|
3721
|
+
'/+(.*)',
|
|
3719
3722
|
// Note that the bracket here is inside the capturing group, since we consider it part of the
|
|
3720
3723
|
// phone number. Will match a pattern like "(650) 223 3345 (754) 223 3321".
|
|
3721
3724
|
'(\\([^(]*)', // Breaks on a hyphen - e.g. "12345 - 332-445-1234 is my number."
|
|
@@ -3835,7 +3838,12 @@ var PhoneNumberMatcher$1 = /*#__PURE__*/function () {
|
|
|
3835
3838
|
|
|
3836
3839
|
/** The maximum number of retries after matching an invalid number. */
|
|
3837
3840
|
this.maxTries = options.maxTries;
|
|
3841
|
+
|
|
3842
|
+
// Compile regular expressions.
|
|
3838
3843
|
this.PATTERN = new RegExp(PATTERN, 'ig');
|
|
3844
|
+
this.INNER_MATCHES = INNER_MATCHES.map(function (pattern) {
|
|
3845
|
+
return new RegExp(pattern, 'g');
|
|
3846
|
+
});
|
|
3839
3847
|
|
|
3840
3848
|
/** The iteration tristate. */
|
|
3841
3849
|
this.state = 'NOT_READY';
|
|
@@ -3859,10 +3867,9 @@ var PhoneNumberMatcher$1 = /*#__PURE__*/function () {
|
|
|
3859
3867
|
*/
|
|
3860
3868
|
return _createClass$7(PhoneNumberMatcher, [{
|
|
3861
3869
|
key: "find",
|
|
3862
|
-
value: function find() {
|
|
3863
|
-
//
|
|
3864
|
-
|
|
3865
|
-
|
|
3870
|
+
value: function find(index) {
|
|
3871
|
+
// Reset the regular expression.
|
|
3872
|
+
this.PATTERN.lastIndex = index;
|
|
3866
3873
|
var matches;
|
|
3867
3874
|
while (this.maxTries > 0 && (matches = this.PATTERN.exec(this.text)) !== null) {
|
|
3868
3875
|
var candidate = matches[0];
|
|
@@ -3915,11 +3922,12 @@ var PhoneNumberMatcher$1 = /*#__PURE__*/function () {
|
|
|
3915
3922
|
}, {
|
|
3916
3923
|
key: "extractInnerMatch",
|
|
3917
3924
|
value: function extractInnerMatch(substring, offset, text) {
|
|
3918
|
-
for (var
|
|
3919
|
-
var
|
|
3925
|
+
for (var _iterator = _createForOfIteratorHelperLoose$3(this.INNER_MATCHES), _step; !(_step = _iterator()).done;) {
|
|
3926
|
+
var innerMatchRegExp = _step.value;
|
|
3927
|
+
// Reset regular expression.
|
|
3928
|
+
innerMatchRegExp.lastIndex = 0;
|
|
3920
3929
|
var isFirstMatch = true;
|
|
3921
3930
|
var candidateMatch = void 0;
|
|
3922
|
-
var innerMatchRegExp = new RegExp(innerMatchPattern, 'g');
|
|
3923
3931
|
while (this.maxTries > 0 && (candidateMatch = innerMatchRegExp.exec(substring)) !== null) {
|
|
3924
3932
|
if (isFirstMatch) {
|
|
3925
3933
|
// We should handle any group before this one too.
|
|
@@ -3991,10 +3999,9 @@ var PhoneNumberMatcher$1 = /*#__PURE__*/function () {
|
|
|
3991
3999
|
key: "hasNext",
|
|
3992
4000
|
value: function hasNext() {
|
|
3993
4001
|
if (this.state === 'NOT_READY') {
|
|
3994
|
-
this.lastMatch = this.find(
|
|
3995
|
-
|
|
4002
|
+
this.lastMatch = this.find(this.searchIndex);
|
|
3996
4003
|
if (this.lastMatch) {
|
|
3997
|
-
|
|
4004
|
+
this.searchIndex = this.lastMatch.endsAt;
|
|
3998
4005
|
this.state = 'READY';
|
|
3999
4006
|
} else {
|
|
4000
4007
|
this.state = 'DONE';
|
|
@@ -6596,7 +6603,17 @@ function formatIncompletePhoneNumber() {
|
|
|
6596
6603
|
function PhoneNumber(number) {
|
|
6597
6604
|
return PhoneNumber$1.call(this, number, metadata)
|
|
6598
6605
|
}
|
|
6599
|
-
PhoneNumber.prototype
|
|
6606
|
+
// Setting `PhoneNumber.prototype` via `Object.create()`
|
|
6607
|
+
// didn't work with `instanceof` operator for some strange reason.
|
|
6608
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/201
|
|
6609
|
+
// Because of that issue, the `Object.create()` call had to be removed.
|
|
6610
|
+
// It didn't result in any drawbacks because the `{}` argument of that call
|
|
6611
|
+
// means that the `PhoneNumber` class created here adds 0 new properties
|
|
6612
|
+
// to the existing `PhoneNumber` class it attempts to extend here.
|
|
6613
|
+
// Hence, the `Object.create()` call can be omitted
|
|
6614
|
+
// and the `prototype` can just be copied over as is.
|
|
6615
|
+
// PhoneNumber.prototype = Object.create(_PhoneNumber.prototype, {})
|
|
6616
|
+
PhoneNumber.prototype = PhoneNumber$1.prototype;
|
|
6600
6617
|
PhoneNumber.prototype.constructor = PhoneNumber;
|
|
6601
6618
|
|
|
6602
6619
|
function parseNumber() {
|