metadata.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5. import compare from './tools/semver-compare.js';
  6. import isObject from './helpers/isObject.js'; // Added "possibleLengths" and renamed
  7. // "country_phone_code_to_countries" to "country_calling_codes".
  8. var V2 = '1.0.18'; // Added "idd_prefix" and "default_idd_prefix".
  9. var V3 = '1.2.0'; // Moved `001` country code to "nonGeographic" section of metadata.
  10. var V4 = '1.7.35';
  11. var DEFAULT_EXT_PREFIX = ' ext. ';
  12. var CALLING_CODE_REG_EXP = /^\d+$/;
  13. /**
  14. * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md
  15. */
  16. var Metadata = /*#__PURE__*/function () {
  17. function Metadata(metadata) {
  18. _classCallCheck(this, Metadata);
  19. validateMetadata(metadata);
  20. this.metadata = metadata;
  21. setVersion.call(this, metadata);
  22. }
  23. _createClass(Metadata, [{
  24. key: "getCountries",
  25. value: function getCountries() {
  26. return Object.keys(this.metadata.countries).filter(function (_) {
  27. return _ !== '001';
  28. });
  29. }
  30. }, {
  31. key: "getCountryMetadata",
  32. value: function getCountryMetadata(countryCode) {
  33. return this.metadata.countries[countryCode];
  34. }
  35. }, {
  36. key: "nonGeographic",
  37. value: function nonGeographic() {
  38. if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.
  39. // It's present in metadata generated from `1.7.35` to `1.7.37`.
  40. // The test case could be found by searching for "nonGeographical".
  41. return this.metadata.nonGeographic || this.metadata.nonGeographical;
  42. }
  43. }, {
  44. key: "hasCountry",
  45. value: function hasCountry(country) {
  46. return this.getCountryMetadata(country) !== undefined;
  47. }
  48. }, {
  49. key: "hasCallingCode",
  50. value: function hasCallingCode(callingCode) {
  51. if (this.getCountryCodesForCallingCode(callingCode)) {
  52. return true;
  53. }
  54. if (this.nonGeographic()) {
  55. if (this.nonGeographic()[callingCode]) {
  56. return true;
  57. }
  58. } else {
  59. // A hacky workaround for old custom metadata (generated before V4).
  60. var countryCodes = this.countryCallingCodes()[callingCode];
  61. if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
  62. return true;
  63. }
  64. }
  65. }
  66. }, {
  67. key: "isNonGeographicCallingCode",
  68. value: function isNonGeographicCallingCode(callingCode) {
  69. if (this.nonGeographic()) {
  70. return this.nonGeographic()[callingCode] ? true : false;
  71. } else {
  72. return this.getCountryCodesForCallingCode(callingCode) ? false : true;
  73. }
  74. } // Deprecated.
  75. }, {
  76. key: "country",
  77. value: function country(countryCode) {
  78. return this.selectNumberingPlan(countryCode);
  79. }
  80. }, {
  81. key: "selectNumberingPlan",
  82. value: function selectNumberingPlan(countryCode, callingCode) {
  83. // Supports just passing `callingCode` as the first argument.
  84. if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {
  85. callingCode = countryCode;
  86. countryCode = null;
  87. }
  88. if (countryCode && countryCode !== '001') {
  89. if (!this.hasCountry(countryCode)) {
  90. throw new Error("Unknown country: ".concat(countryCode));
  91. }
  92. this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);
  93. } else if (callingCode) {
  94. if (!this.hasCallingCode(callingCode)) {
  95. throw new Error("Unknown calling code: ".concat(callingCode));
  96. }
  97. this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);
  98. } else {
  99. this.numberingPlan = undefined;
  100. }
  101. return this;
  102. }
  103. }, {
  104. key: "getCountryCodesForCallingCode",
  105. value: function getCountryCodesForCallingCode(callingCode) {
  106. var countryCodes = this.countryCallingCodes()[callingCode];
  107. if (countryCodes) {
  108. // Metadata before V4 included "non-geographic entity" calling codes
  109. // inside `country_calling_codes` (for example, `"881":["001"]`).
  110. // Now the semantics of `country_calling_codes` has changed:
  111. // it's specifically for "countries" now.
  112. // Older versions of custom metadata will simply skip parsing
  113. // "non-geographic entity" phone numbers with new versions
  114. // of this library: it's not considered a bug,
  115. // because such numbers are extremely rare,
  116. // and developers extremely rarely use custom metadata.
  117. if (countryCodes.length === 1 && countryCodes[0].length === 3) {
  118. return;
  119. }
  120. return countryCodes;
  121. }
  122. }
  123. }, {
  124. key: "getCountryCodeForCallingCode",
  125. value: function getCountryCodeForCallingCode(callingCode) {
  126. var countryCodes = this.getCountryCodesForCallingCode(callingCode);
  127. if (countryCodes) {
  128. return countryCodes[0];
  129. }
  130. }
  131. }, {
  132. key: "getNumberingPlanMetadata",
  133. value: function getNumberingPlanMetadata(callingCode) {
  134. var countryCode = this.getCountryCodeForCallingCode(callingCode);
  135. if (countryCode) {
  136. return this.getCountryMetadata(countryCode);
  137. }
  138. if (this.nonGeographic()) {
  139. var metadata = this.nonGeographic()[callingCode];
  140. if (metadata) {
  141. return metadata;
  142. }
  143. } else {
  144. // A hacky workaround for old custom metadata (generated before V4).
  145. // In that metadata, there was no concept of "non-geographic" metadata
  146. // so metadata for `001` country code was stored along with other countries.
  147. // The test case can be found by searching for:
  148. // "should work around `nonGeographic` metadata not existing".
  149. var countryCodes = this.countryCallingCodes()[callingCode];
  150. if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
  151. return this.metadata.countries['001'];
  152. }
  153. }
  154. } // Deprecated.
  155. }, {
  156. key: "countryCallingCode",
  157. value: function countryCallingCode() {
  158. return this.numberingPlan.callingCode();
  159. } // Deprecated.
  160. }, {
  161. key: "IDDPrefix",
  162. value: function IDDPrefix() {
  163. return this.numberingPlan.IDDPrefix();
  164. } // Deprecated.
  165. }, {
  166. key: "defaultIDDPrefix",
  167. value: function defaultIDDPrefix() {
  168. return this.numberingPlan.defaultIDDPrefix();
  169. } // Deprecated.
  170. }, {
  171. key: "nationalNumberPattern",
  172. value: function nationalNumberPattern() {
  173. return this.numberingPlan.nationalNumberPattern();
  174. } // Deprecated.
  175. }, {
  176. key: "possibleLengths",
  177. value: function possibleLengths() {
  178. return this.numberingPlan.possibleLengths();
  179. } // Deprecated.
  180. }, {
  181. key: "formats",
  182. value: function formats() {
  183. return this.numberingPlan.formats();
  184. } // Deprecated.
  185. }, {
  186. key: "nationalPrefixForParsing",
  187. value: function nationalPrefixForParsing() {
  188. return this.numberingPlan.nationalPrefixForParsing();
  189. } // Deprecated.
  190. }, {
  191. key: "nationalPrefixTransformRule",
  192. value: function nationalPrefixTransformRule() {
  193. return this.numberingPlan.nationalPrefixTransformRule();
  194. } // Deprecated.
  195. }, {
  196. key: "leadingDigits",
  197. value: function leadingDigits() {
  198. return this.numberingPlan.leadingDigits();
  199. } // Deprecated.
  200. }, {
  201. key: "hasTypes",
  202. value: function hasTypes() {
  203. return this.numberingPlan.hasTypes();
  204. } // Deprecated.
  205. }, {
  206. key: "type",
  207. value: function type(_type) {
  208. return this.numberingPlan.type(_type);
  209. } // Deprecated.
  210. }, {
  211. key: "ext",
  212. value: function ext() {
  213. return this.numberingPlan.ext();
  214. }
  215. }, {
  216. key: "countryCallingCodes",
  217. value: function countryCallingCodes() {
  218. if (this.v1) return this.metadata.country_phone_code_to_countries;
  219. return this.metadata.country_calling_codes;
  220. } // Deprecated.
  221. }, {
  222. key: "chooseCountryByCountryCallingCode",
  223. value: function chooseCountryByCountryCallingCode(callingCode) {
  224. return this.selectNumberingPlan(callingCode);
  225. }
  226. }, {
  227. key: "hasSelectedNumberingPlan",
  228. value: function hasSelectedNumberingPlan() {
  229. return this.numberingPlan !== undefined;
  230. }
  231. }]);
  232. return Metadata;
  233. }();
  234. export { Metadata as default };
  235. var NumberingPlan = /*#__PURE__*/function () {
  236. function NumberingPlan(metadata, globalMetadataObject) {
  237. _classCallCheck(this, NumberingPlan);
  238. this.globalMetadataObject = globalMetadataObject;
  239. this.metadata = metadata;
  240. setVersion.call(this, globalMetadataObject.metadata);
  241. }
  242. _createClass(NumberingPlan, [{
  243. key: "callingCode",
  244. value: function callingCode() {
  245. return this.metadata[0];
  246. } // Formatting information for regions which share
  247. // a country calling code is contained by only one region
  248. // for performance reasons. For example, for NANPA region
  249. // ("North American Numbering Plan Administration",
  250. // which includes USA, Canada, Cayman Islands, Bahamas, etc)
  251. // it will be contained in the metadata for `US`.
  252. }, {
  253. key: "getDefaultCountryMetadataForRegion",
  254. value: function getDefaultCountryMetadataForRegion() {
  255. return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
  256. } // Is always present.
  257. }, {
  258. key: "IDDPrefix",
  259. value: function IDDPrefix() {
  260. if (this.v1 || this.v2) return;
  261. return this.metadata[1];
  262. } // Is only present when a country supports multiple IDD prefixes.
  263. }, {
  264. key: "defaultIDDPrefix",
  265. value: function defaultIDDPrefix() {
  266. if (this.v1 || this.v2) return;
  267. return this.metadata[12];
  268. }
  269. }, {
  270. key: "nationalNumberPattern",
  271. value: function nationalNumberPattern() {
  272. if (this.v1 || this.v2) return this.metadata[1];
  273. return this.metadata[2];
  274. } // "possible length" data is always present in Google's metadata.
  275. }, {
  276. key: "possibleLengths",
  277. value: function possibleLengths() {
  278. if (this.v1) return;
  279. return this.metadata[this.v2 ? 2 : 3];
  280. }
  281. }, {
  282. key: "_getFormats",
  283. value: function _getFormats(metadata) {
  284. return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];
  285. } // For countries of the same region (e.g. NANPA)
  286. // formats are all stored in the "main" country for that region.
  287. // E.g. "RU" and "KZ", "US" and "CA".
  288. }, {
  289. key: "formats",
  290. value: function formats() {
  291. var _this = this;
  292. var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
  293. return formats.map(function (_) {
  294. return new Format(_, _this);
  295. });
  296. }
  297. }, {
  298. key: "nationalPrefix",
  299. value: function nationalPrefix() {
  300. return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
  301. }
  302. }, {
  303. key: "_getNationalPrefixFormattingRule",
  304. value: function _getNationalPrefixFormattingRule(metadata) {
  305. return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];
  306. } // For countries of the same region (e.g. NANPA)
  307. // national prefix formatting rule is stored in the "main" country for that region.
  308. // E.g. "RU" and "KZ", "US" and "CA".
  309. }, {
  310. key: "nationalPrefixFormattingRule",
  311. value: function nationalPrefixFormattingRule() {
  312. return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
  313. }
  314. }, {
  315. key: "_nationalPrefixForParsing",
  316. value: function _nationalPrefixForParsing() {
  317. return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
  318. }
  319. }, {
  320. key: "nationalPrefixForParsing",
  321. value: function nationalPrefixForParsing() {
  322. // If `national_prefix_for_parsing` is not set explicitly,
  323. // then infer it from `national_prefix` (if any)
  324. return this._nationalPrefixForParsing() || this.nationalPrefix();
  325. }
  326. }, {
  327. key: "nationalPrefixTransformRule",
  328. value: function nationalPrefixTransformRule() {
  329. return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
  330. }
  331. }, {
  332. key: "_getNationalPrefixIsOptionalWhenFormatting",
  333. value: function _getNationalPrefixIsOptionalWhenFormatting() {
  334. return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
  335. } // For countries of the same region (e.g. NANPA)
  336. // "national prefix is optional when formatting" flag is
  337. // stored in the "main" country for that region.
  338. // E.g. "RU" and "KZ", "US" and "CA".
  339. }, {
  340. key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
  341. value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
  342. return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
  343. }
  344. }, {
  345. key: "leadingDigits",
  346. value: function leadingDigits() {
  347. return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
  348. }
  349. }, {
  350. key: "types",
  351. value: function types() {
  352. return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
  353. }
  354. }, {
  355. key: "hasTypes",
  356. value: function hasTypes() {
  357. // Versions 1.2.0 - 1.2.4: can be `[]`.
  358. /* istanbul ignore next */
  359. if (this.types() && this.types().length === 0) {
  360. return false;
  361. } // Versions <= 1.2.4: can be `undefined`.
  362. // Version >= 1.2.5: can be `0`.
  363. return !!this.types();
  364. }
  365. }, {
  366. key: "type",
  367. value: function type(_type2) {
  368. if (this.hasTypes() && getType(this.types(), _type2)) {
  369. return new Type(getType(this.types(), _type2), this);
  370. }
  371. }
  372. }, {
  373. key: "ext",
  374. value: function ext() {
  375. if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;
  376. return this.metadata[13] || DEFAULT_EXT_PREFIX;
  377. }
  378. }]);
  379. return NumberingPlan;
  380. }();
  381. var Format = /*#__PURE__*/function () {
  382. function Format(format, metadata) {
  383. _classCallCheck(this, Format);
  384. this._format = format;
  385. this.metadata = metadata;
  386. }
  387. _createClass(Format, [{
  388. key: "pattern",
  389. value: function pattern() {
  390. return this._format[0];
  391. }
  392. }, {
  393. key: "format",
  394. value: function format() {
  395. return this._format[1];
  396. }
  397. }, {
  398. key: "leadingDigitsPatterns",
  399. value: function leadingDigitsPatterns() {
  400. return this._format[2] || [];
  401. }
  402. }, {
  403. key: "nationalPrefixFormattingRule",
  404. value: function nationalPrefixFormattingRule() {
  405. return this._format[3] || this.metadata.nationalPrefixFormattingRule();
  406. }
  407. }, {
  408. key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
  409. value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
  410. return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
  411. }
  412. }, {
  413. key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
  414. value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {
  415. // National prefix is omitted if there's no national prefix formatting rule
  416. // set for this country, or when the national prefix formatting rule
  417. // contains no national prefix itself, or when this rule is set but
  418. // national prefix is optional for this phone number format
  419. // (and it is not enforced explicitly)
  420. return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
  421. } // Checks whether national prefix formatting rule contains national prefix.
  422. }, {
  423. key: "usesNationalPrefix",
  424. value: function usesNationalPrefix() {
  425. return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
  426. !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`
  427. // when `national_prefix_formatting_rule` is not present.
  428. // So, `true` or `false` are returned explicitly here, so that
  429. // `0` number isn't returned.
  430. ? true : false;
  431. }
  432. }, {
  433. key: "internationalFormat",
  434. value: function internationalFormat() {
  435. return this._format[5] || this.format();
  436. }
  437. }]);
  438. return Format;
  439. }();
  440. /**
  441. * A pattern that is used to determine if the national prefix formatting rule
  442. * has the first group only, i.e., does not start with the national prefix.
  443. * Note that the pattern explicitly allows for unbalanced parentheses.
  444. */
  445. var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/;
  446. var Type = /*#__PURE__*/function () {
  447. function Type(type, metadata) {
  448. _classCallCheck(this, Type);
  449. this.type = type;
  450. this.metadata = metadata;
  451. }
  452. _createClass(Type, [{
  453. key: "pattern",
  454. value: function pattern() {
  455. if (this.metadata.v1) return this.type;
  456. return this.type[0];
  457. }
  458. }, {
  459. key: "possibleLengths",
  460. value: function possibleLengths() {
  461. if (this.metadata.v1) return;
  462. return this.type[1] || this.metadata.possibleLengths();
  463. }
  464. }]);
  465. return Type;
  466. }();
  467. function getType(types, type) {
  468. switch (type) {
  469. case 'FIXED_LINE':
  470. return types[0];
  471. case 'MOBILE':
  472. return types[1];
  473. case 'TOLL_FREE':
  474. return types[2];
  475. case 'PREMIUM_RATE':
  476. return types[3];
  477. case 'PERSONAL_NUMBER':
  478. return types[4];
  479. case 'VOICEMAIL':
  480. return types[5];
  481. case 'UAN':
  482. return types[6];
  483. case 'PAGER':
  484. return types[7];
  485. case 'VOIP':
  486. return types[8];
  487. case 'SHARED_COST':
  488. return types[9];
  489. }
  490. }
  491. export function validateMetadata(metadata) {
  492. if (!metadata) {
  493. throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');
  494. } // `country_phone_code_to_countries` was renamed to
  495. // `country_calling_codes` in `1.0.18`.
  496. if (!isObject(metadata) || !isObject(metadata.countries)) {
  497. throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(isObject(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + typeOf(metadata) + ': ' + metadata, "."));
  498. }
  499. } // Babel transforms `typeof` into some "branches"
  500. // so istanbul will show this as "branch not covered".
  501. /* istanbul ignore next */
  502. var typeOf = function typeOf(_) {
  503. return _typeof(_);
  504. };
  505. /**
  506. * Returns extension prefix for a country.
  507. * @param {string} country
  508. * @param {object} metadata
  509. * @return {string?}
  510. * @example
  511. * // Returns " ext. "
  512. * getExtPrefix("US")
  513. */
  514. export function getExtPrefix(country, metadata) {
  515. metadata = new Metadata(metadata);
  516. if (metadata.hasCountry(country)) {
  517. return metadata.country(country).ext();
  518. }
  519. return DEFAULT_EXT_PREFIX;
  520. }
  521. /**
  522. * Returns "country calling code" for a country.
  523. * Throws an error if the country doesn't exist or isn't supported by this library.
  524. * @param {string} country
  525. * @param {object} metadata
  526. * @return {string}
  527. * @example
  528. * // Returns "44"
  529. * getCountryCallingCode("GB")
  530. */
  531. export function getCountryCallingCode(country, metadata) {
  532. metadata = new Metadata(metadata);
  533. if (metadata.hasCountry(country)) {
  534. return metadata.country(country).countryCallingCode();
  535. }
  536. throw new Error("Unknown country: ".concat(country));
  537. }
  538. export function isSupportedCountry(country, metadata) {
  539. // metadata = new Metadata(metadata)
  540. // return metadata.hasCountry(country)
  541. return metadata.countries.hasOwnProperty(country);
  542. }
  543. function setVersion(metadata) {
  544. var version = metadata.version;
  545. if (typeof version === 'number') {
  546. this.v1 = version === 1;
  547. this.v2 = version === 2;
  548. this.v3 = version === 3;
  549. this.v4 = version === 4;
  550. } else {
  551. if (!version) {
  552. this.v1 = true;
  553. } else if (compare(version, V3) === -1) {
  554. this.v2 = true;
  555. } else if (compare(version, V4) === -1) {
  556. this.v3 = true;
  557. } else {
  558. this.v4 = true;
  559. }
  560. }
  561. } // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/
  562. // function isCountryCode(countryCode) {
  563. // return ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)
  564. // }
  565. //# sourceMappingURL=metadata.js.map