@ticketmaster/tm-global-address 0.3.0 → 0.5.0

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.
Files changed (70) hide show
  1. package/dist/components/AddressForm/AddressForm.js +174 -192
  2. package/dist/data/countries.d.ts +18 -0
  3. package/dist/data/countries.js +261 -0
  4. package/dist/data/countryConfig.d.ts +9 -0
  5. package/dist/data/countryConfig.js +87 -0
  6. package/dist/data/countryData.d.ts +7 -9
  7. package/dist/data/countryData.js +25 -542
  8. package/dist/data/index.d.ts +22 -0
  9. package/dist/data/postalPatterns.d.ts +22 -0
  10. package/dist/data/postalPatterns.js +183 -0
  11. package/dist/data/states.d.ts +15 -0
  12. package/dist/data/states.js +1405 -0
  13. package/dist/index.d.ts +12 -1
  14. package/dist/index.js +38 -15
  15. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/ParseError.js +89 -0
  16. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/PhoneNumber.js +188 -0
  17. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/constants.js +10 -0
  18. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/format.js +92 -0
  19. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +11 -0
  20. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +7 -0
  21. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +16 -0
  22. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +11 -0
  23. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +18 -0
  24. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +47 -0
  25. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +22 -0
  26. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +23 -0
  27. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +39 -0
  28. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +31 -0
  29. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +23 -0
  30. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +25 -0
  31. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +12 -0
  32. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +45 -0
  33. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +12 -0
  34. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +51 -0
  35. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +14 -0
  36. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/isObject.js +7 -0
  37. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +20 -0
  38. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +6 -0
  39. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +79 -0
  40. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +19 -0
  41. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/isPossible.js +38 -0
  42. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/isValid.js +12 -0
  43. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/metadata.js +473 -0
  44. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/normalizeArguments.js +108 -0
  45. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parse.js +119 -0
  46. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +40 -0
  47. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +9 -0
  48. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +55 -0
  49. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +62 -0
  50. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/tools/semver-compare.js +14 -0
  51. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/max/exports/parsePhoneNumber.js +8 -0
  52. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/max/exports/withMetadataArgument.js +8 -0
  53. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/metadata.max.json.js +4 -0
  54. package/dist/validation/constants.d.ts +2 -0
  55. package/dist/validation/constants.js +152 -0
  56. package/dist/validation/index.d.ts +15 -0
  57. package/dist/validation/sanitize.d.ts +13 -0
  58. package/dist/validation/sanitize.js +6 -0
  59. package/dist/validation/types.d.ts +46 -0
  60. package/dist/validation/validateForm.d.ts +7 -0
  61. package/dist/validation/validateForm.js +22 -0
  62. package/dist/validation/validatePhoneNumber.d.ts +3 -0
  63. package/dist/validation/validatePhoneNumber.js +17 -0
  64. package/dist/validation/validatePostalCode.d.ts +3 -0
  65. package/dist/validation/validatePostalCode.js +22 -0
  66. package/dist/validation/validateState.d.ts +3 -0
  67. package/dist/validation/validateState.js +23 -0
  68. package/dist/validation/validateTextField.d.ts +2 -0
  69. package/dist/validation/validateTextField.js +36 -0
  70. package/package.json +4 -1
@@ -0,0 +1,31 @@
1
+ function F(l, i) {
2
+ if (l && i.numberingPlan.nationalPrefixForParsing()) {
3
+ var g = new RegExp("^(?:" + i.numberingPlan.nationalPrefixForParsing() + ")"), n = g.exec(l);
4
+ if (n) {
5
+ var r, P, v = n.length - 1, e = v > 0 && n[v];
6
+ if (i.nationalPrefixTransformRule() && e)
7
+ r = l.replace(g, i.nationalPrefixTransformRule()), v > 1 && (P = n[1]);
8
+ else {
9
+ var o = n[0];
10
+ r = l.slice(o.length), e && (P = n[1]);
11
+ }
12
+ var f;
13
+ if (e) {
14
+ var s = l.indexOf(n[1]), a = l.slice(0, s);
15
+ a === i.numberingPlan.nationalPrefix() && (f = i.numberingPlan.nationalPrefix());
16
+ } else
17
+ f = n[0];
18
+ return {
19
+ nationalNumber: r,
20
+ nationalPrefix: f,
21
+ carrierCode: P
22
+ };
23
+ }
24
+ }
25
+ return {
26
+ nationalNumber: l
27
+ };
28
+ }
29
+ export {
30
+ F as default
31
+ };
@@ -0,0 +1,23 @@
1
+ import { VALID_DIGITS as n } from "../constants.js";
2
+ var v = "+", I = "[\\-\\.\\(\\)]?", R = "([" + n + "]|" + I + ")", i = "^\\" + v + R + "*[" + n + "]" + R + "*$", N = new RegExp(i, "g"), r = n, C = "[" + r + "]+((\\-)*[" + r + "])*", L = "a-zA-Z", f = "[" + L + "]+((\\-)*[" + r + "])*", E = "^(" + C + "\\.)*" + f + "\\.?$", O = new RegExp(E, "g"), l = "tel:", a = ";phone-context=", u = ";isub=";
3
+ function D(_) {
4
+ var t = _.indexOf(a);
5
+ if (t < 0)
6
+ return null;
7
+ var e = t + a.length;
8
+ if (e >= _.length)
9
+ return "";
10
+ var A = _.indexOf(";", e);
11
+ return A >= 0 ? _.substring(e, A) : _.substring(e);
12
+ }
13
+ function S(_) {
14
+ return _ === null ? !0 : _.length === 0 ? !1 : N.test(_) || O.test(_);
15
+ }
16
+ export {
17
+ v as PLUS_SIGN,
18
+ u as RFC3966_ISDN_SUBADDRESS_,
19
+ a as RFC3966_PHONE_CONTEXT_,
20
+ l as RFC3966_PREFIX_,
21
+ D as default,
22
+ S as isPhoneContextValid
23
+ };
@@ -0,0 +1,25 @@
1
+ import o from "./applyInternationalSeparatorStyle.js";
2
+ var l = /(\$\d)/;
3
+ function m(e, a, t) {
4
+ var r = t.useInternationalFormat, i = t.withNationalPrefix, n = e.replace(new RegExp(a.pattern()), r ? a.internationalFormat() : (
5
+ // This library doesn't use `domestic_carrier_code_formatting_rule`,
6
+ // because that one is only used when formatting phone numbers
7
+ // for dialing from a mobile phone, and this is not a dialing library.
8
+ // carrierCode && format.domesticCarrierCodeFormattingRule()
9
+ // // First, replace the $CC in the formatting rule with the desired carrier code.
10
+ // // Then, replace the $FG in the formatting rule with the first group
11
+ // // and the carrier code combined in the appropriate way.
12
+ // ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
13
+ // : (
14
+ // withNationalPrefix && format.nationalPrefixFormattingRule()
15
+ // ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
16
+ // : format.format()
17
+ // )
18
+ i && a.nationalPrefixFormattingRule() ? a.format().replace(l, a.nationalPrefixFormattingRule()) : a.format()
19
+ ));
20
+ return r ? o(n) : n;
21
+ }
22
+ export {
23
+ l as FIRST_GROUP_PATTERN,
24
+ m as default
25
+ };
@@ -0,0 +1,12 @@
1
+ import o from "./getCountryByNationalNumber.js";
2
+ function i(n, a) {
3
+ var r = a.nationalNumber, e = a.metadata, t = e.getCountryCodesForCallingCode(n);
4
+ if (t)
5
+ return t.length === 1 ? t[0] : o(r, {
6
+ countries: t,
7
+ metadata: e.metadata
8
+ });
9
+ }
10
+ export {
11
+ i as default
12
+ };
@@ -0,0 +1,45 @@
1
+ import l from "../metadata.js";
2
+ import f from "./getNumberType.js";
3
+ function d(e, r) {
4
+ var t = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
5
+ if (t) return (t = t.call(e)).next.bind(t);
6
+ if (Array.isArray(e) || (t = s(e)) || r) {
7
+ t && (e = t);
8
+ var a = 0;
9
+ return function() {
10
+ return a >= e.length ? { done: !0 } : { done: !1, value: e[a++] };
11
+ };
12
+ }
13
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
14
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
15
+ }
16
+ function s(e, r) {
17
+ if (e) {
18
+ if (typeof e == "string") return i(e, r);
19
+ var t = {}.toString.call(e).slice(8, -1);
20
+ return t === "Object" && e.constructor && (t = e.constructor.name), t === "Map" || t === "Set" ? Array.from(e) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? i(e, r) : void 0;
21
+ }
22
+ }
23
+ function i(e, r) {
24
+ (r == null || r > e.length) && (r = e.length);
25
+ for (var t = 0, a = Array(r); t < r; t++) a[t] = e[t];
26
+ return a;
27
+ }
28
+ function y(e, r) {
29
+ var t = r.countries, a = r.metadata;
30
+ a = new l(a);
31
+ for (var u = d(t), o; !(o = u()).done; ) {
32
+ var n = o.value;
33
+ if (a.selectNumberingPlan(n), a.leadingDigits()) {
34
+ if (e && e.search(a.leadingDigits()) === 0)
35
+ return n;
36
+ } else if (f({
37
+ phone: e,
38
+ country: n
39
+ }, void 0, a.metadata))
40
+ return n;
41
+ }
42
+ }
43
+ export {
44
+ y as default
45
+ };
@@ -0,0 +1,12 @@
1
+ import f from "../metadata.js";
2
+ var u = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
3
+ function D(t, r, a) {
4
+ var e = new f(a);
5
+ if (e.selectNumberingPlan(t, r), e.defaultIDDPrefix())
6
+ return e.defaultIDDPrefix();
7
+ if (u.test(e.IDDPrefix()))
8
+ return e.IDDPrefix();
9
+ }
10
+ export {
11
+ D as default
12
+ };
@@ -0,0 +1,51 @@
1
+ import a from "../metadata.js";
2
+ import f from "./matchesEntirely.js";
3
+ function I(e, n) {
4
+ var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
5
+ if (r) return (r = r.call(e)).next.bind(r);
6
+ if (Array.isArray(e) || (r = y(e)) || n) {
7
+ r && (e = r);
8
+ var t = 0;
9
+ return function() {
10
+ return t >= e.length ? { done: !0 } : { done: !1, value: e[t++] };
11
+ };
12
+ }
13
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
14
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
15
+ }
16
+ function y(e, n) {
17
+ if (e) {
18
+ if (typeof e == "string") return l(e, n);
19
+ var r = {}.toString.call(e).slice(8, -1);
20
+ return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? l(e, n) : void 0;
21
+ }
22
+ }
23
+ function l(e, n) {
24
+ (n == null || n > e.length) && (n = e.length);
25
+ for (var r = 0, t = Array(n); r < n; r++) t[r] = e[r];
26
+ return t;
27
+ }
28
+ var c = ["MOBILE", "PREMIUM_RATE", "TOLL_FREE", "SHARED_COST", "VOIP", "PERSONAL_NUMBER", "PAGER", "UAN", "VOICEMAIL"];
29
+ function O(e, n, r) {
30
+ if (n = n || {}, !(!e.country && !e.countryCallingCode)) {
31
+ r = new a(r), r.selectNumberingPlan(e.country, e.countryCallingCode);
32
+ var t = n.v2 ? e.nationalNumber : e.phone;
33
+ if (f(t, r.nationalNumberPattern())) {
34
+ if (o(t, "FIXED_LINE", r))
35
+ return r.type("MOBILE") && r.type("MOBILE").pattern() === "" || !r.type("MOBILE") || o(t, "MOBILE", r) ? "FIXED_LINE_OR_MOBILE" : "FIXED_LINE";
36
+ for (var E = I(c), i; !(i = E()).done; ) {
37
+ var u = i.value;
38
+ if (o(t, u, r))
39
+ return u;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ function o(e, n, r) {
45
+ var t = r.type(n);
46
+ return !t || !t.pattern() || t.possibleLengths() && t.possibleLengths().indexOf(e.length) < 0 ? !1 : f(e, t.pattern());
47
+ }
48
+ export {
49
+ O as default,
50
+ o as isNumberTypeEqualTo
51
+ };
@@ -0,0 +1,14 @@
1
+ import u from "../metadata.js";
2
+ function s(r, t, e) {
3
+ var n = new u(e), o = n.getCountryCodesForCallingCode(r);
4
+ return o ? o.filter(function(a) {
5
+ return i(t, a, e);
6
+ }) : [];
7
+ }
8
+ function i(r, t, e) {
9
+ var n = new u(e);
10
+ return n.selectNumberingPlan(t), n.numberingPlan.possibleLengths().indexOf(r.length) >= 0;
11
+ }
12
+ export {
13
+ s as default
14
+ };
@@ -0,0 +1,7 @@
1
+ var t = {}.constructor;
2
+ function n(r) {
3
+ return r != null && r.constructor === t;
4
+ }
5
+ export {
6
+ n as default
7
+ };
@@ -0,0 +1,20 @@
1
+ import { MIN_LENGTH_FOR_NSN as e, VALID_DIGITS as _, PLUS_CHARS as t, VALID_PUNCTUATION as E } from "../constants.js";
2
+ import r from "./extension/createExtensionPattern.js";
3
+ var n = "[" + _ + "]{" + e + "}", I = "[" + t + "]{0,1}(?:[" + E + "]*[" + _ + "]){3,}[" + E + _ + "]*", P = new RegExp("^[" + t + "]{0,1}(?:[" + E + "]*[" + _ + "]){1,2}$", "i"), R = I + // Phone number extensions
4
+ "(?:" + r() + ")?", T = new RegExp(
5
+ // Either a short two-digit-only phone number
6
+ "^" + n + "$|^" + R + "$",
7
+ "i"
8
+ );
9
+ function A(N) {
10
+ return N.length >= e && T.test(N);
11
+ }
12
+ function o(N) {
13
+ return P.test(N);
14
+ }
15
+ export {
16
+ I as VALID_PHONE_NUMBER,
17
+ R as VALID_PHONE_NUMBER_WITH_EXTENSION,
18
+ A as default,
19
+ o as isViablePhoneNumberStart
20
+ };
@@ -0,0 +1,6 @@
1
+ function r(e, n) {
2
+ return e = e || "", new RegExp("^(?:" + n + ")$").test(e);
3
+ }
4
+ export {
5
+ r as default
6
+ };
@@ -0,0 +1,79 @@
1
+ var F = {
2
+ 0: "0",
3
+ 1: "1",
4
+ 2: "2",
5
+ 3: "3",
6
+ 4: "4",
7
+ 5: "5",
8
+ 6: "6",
9
+ 7: "7",
10
+ 8: "8",
11
+ 9: "9",
12
+ "0": "0",
13
+ // Fullwidth digit 0
14
+ "1": "1",
15
+ // Fullwidth digit 1
16
+ "2": "2",
17
+ // Fullwidth digit 2
18
+ "3": "3",
19
+ // Fullwidth digit 3
20
+ "4": "4",
21
+ // Fullwidth digit 4
22
+ "5": "5",
23
+ // Fullwidth digit 5
24
+ "6": "6",
25
+ // Fullwidth digit 6
26
+ "7": "7",
27
+ // Fullwidth digit 7
28
+ "8": "8",
29
+ // Fullwidth digit 8
30
+ "9": "9",
31
+ // Fullwidth digit 9
32
+ "٠": "0",
33
+ // Arabic-indic digit 0
34
+ "١": "1",
35
+ // Arabic-indic digit 1
36
+ "٢": "2",
37
+ // Arabic-indic digit 2
38
+ "٣": "3",
39
+ // Arabic-indic digit 3
40
+ "٤": "4",
41
+ // Arabic-indic digit 4
42
+ "٥": "5",
43
+ // Arabic-indic digit 5
44
+ "٦": "6",
45
+ // Arabic-indic digit 6
46
+ "٧": "7",
47
+ // Arabic-indic digit 7
48
+ "٨": "8",
49
+ // Arabic-indic digit 8
50
+ "٩": "9",
51
+ // Arabic-indic digit 9
52
+ "۰": "0",
53
+ // Eastern-Arabic digit 0
54
+ "۱": "1",
55
+ // Eastern-Arabic digit 1
56
+ "۲": "2",
57
+ // Eastern-Arabic digit 2
58
+ "۳": "3",
59
+ // Eastern-Arabic digit 3
60
+ "۴": "4",
61
+ // Eastern-Arabic digit 4
62
+ "۵": "5",
63
+ // Eastern-Arabic digit 5
64
+ "۶": "6",
65
+ // Eastern-Arabic digit 6
66
+ "۷": "7",
67
+ // Eastern-Arabic digit 7
68
+ "۸": "8",
69
+ // Eastern-Arabic digit 8
70
+ "۹": "9"
71
+ // Eastern-Arabic digit 9
72
+ };
73
+ function r(u) {
74
+ return F[u];
75
+ }
76
+ export {
77
+ F as DIGITS,
78
+ r as parseDigit
79
+ };
@@ -0,0 +1,19 @@
1
+ import I from "../metadata.js";
2
+ import { VALID_DIGITS as l } from "../constants.js";
3
+ var c = new RegExp("([" + l + "])");
4
+ function D(t, r, f, n) {
5
+ if (r) {
6
+ var a = new I(n);
7
+ a.selectNumberingPlan(r, f);
8
+ var i = new RegExp(a.IDDPrefix());
9
+ if (t.search(i) === 0) {
10
+ t = t.slice(t.match(i)[0].length);
11
+ var e = t.match(c);
12
+ if (!(e && e[1] != null && e[1].length > 0 && e[1] === "0"))
13
+ return t;
14
+ }
15
+ }
16
+ }
17
+ export {
18
+ D as default
19
+ };
@@ -0,0 +1,38 @@
1
+ import o from "./metadata.js";
2
+ import l from "./helpers/checkNumberLength.js";
3
+ function u(e, n, r) {
4
+ if (n === void 0 && (n = {}), r = new o(r), n.v2) {
5
+ if (!e.countryCallingCode)
6
+ throw new Error("Invalid phone number object passed");
7
+ r.selectNumberingPlan(e.countryCallingCode);
8
+ } else {
9
+ if (!e.phone)
10
+ return !1;
11
+ if (e.country) {
12
+ if (!r.hasCountry(e.country))
13
+ throw new Error("Unknown country: ".concat(e.country));
14
+ r.selectNumberingPlan(e.country);
15
+ } else {
16
+ if (!e.countryCallingCode)
17
+ throw new Error("Invalid phone number object passed");
18
+ r.selectNumberingPlan(e.countryCallingCode);
19
+ }
20
+ }
21
+ if (r.possibleLengths())
22
+ return s(e.phone || e.nationalNumber, e.country, r);
23
+ if (e.countryCallingCode && r.isNonGeographicCallingCode(e.countryCallingCode))
24
+ return !0;
25
+ throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
26
+ }
27
+ function s(e, n, r) {
28
+ switch (l(e, n, r)) {
29
+ case "IS_POSSIBLE":
30
+ return !0;
31
+ default:
32
+ return !1;
33
+ }
34
+ }
35
+ export {
36
+ u as default,
37
+ s as isPossibleNumber
38
+ };
@@ -0,0 +1,12 @@
1
+ import m from "./metadata.js";
2
+ import o from "./helpers/matchesEntirely.js";
3
+ import u from "./helpers/getNumberType.js";
4
+ function b(e, n, r) {
5
+ if (n = n || {}, r = new m(r), r.selectNumberingPlan(e.country, e.countryCallingCode), r.hasTypes())
6
+ return u(e, n, r.metadata) !== void 0;
7
+ var l = n.v2 ? e.nationalNumber : e.phone;
8
+ return o(l, r.nationalNumberPattern());
9
+ }
10
+ export {
11
+ b as default
12
+ };