libphonenumber-js 1.12.9 → 1.12.10

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 (43) hide show
  1. package/CODE_OF_CONDUCT.md +78 -78
  2. package/build/PhoneNumber.js +16 -18
  3. package/build/PhoneNumber.js.map +1 -1
  4. package/build/PhoneNumber.test.js +6 -0
  5. package/build/PhoneNumber.test.js.map +1 -1
  6. package/build/legacy/parse.test.js +1 -1
  7. package/build/legacy/parse.test.js.map +1 -1
  8. package/build/parse.test.js +1 -1
  9. package/build/parse.test.js.map +1 -1
  10. package/build/parsePhoneNumberWithError.test.js +1 -1
  11. package/build/parsePhoneNumberWithError.test.js.map +1 -1
  12. package/bundle/libphonenumber-js.min.js +1 -1
  13. package/bundle/libphonenumber-js.min.js.map +1 -1
  14. package/bundle/libphonenumber-max.js +1 -1
  15. package/bundle/libphonenumber-max.js.map +1 -1
  16. package/bundle/libphonenumber-min.js +1 -1
  17. package/bundle/libphonenumber-min.js.map +1 -1
  18. package/bundle/libphonenumber-mobile.js +1 -1
  19. package/bundle/libphonenumber-mobile.js.map +1 -1
  20. package/es6/PhoneNumber.js +16 -18
  21. package/es6/PhoneNumber.js.map +1 -1
  22. package/es6/PhoneNumber.test.js +6 -0
  23. package/es6/PhoneNumber.test.js.map +1 -1
  24. package/es6/legacy/parse.test.js +1 -1
  25. package/es6/legacy/parse.test.js.map +1 -1
  26. package/es6/parse.test.js +1 -1
  27. package/es6/parse.test.js.map +1 -1
  28. package/es6/parsePhoneNumberWithError.test.js +1 -1
  29. package/es6/parsePhoneNumberWithError.test.js.map +1 -1
  30. package/metadata.full.json +1 -1
  31. package/metadata.full.json.js +1 -1
  32. package/metadata.max.json +1 -1
  33. package/metadata.max.json.js +1 -1
  34. package/metadata.min.json +1 -1
  35. package/metadata.min.json.js +1 -1
  36. package/metadata.mobile.json +1 -1
  37. package/metadata.mobile.json.js +1 -1
  38. package/package.json +1 -1
  39. package/source/PhoneNumber.js +13 -15
  40. package/source/PhoneNumber.test.js +2 -0
  41. package/source/legacy/parse.test.js +1 -1
  42. package/source/parse.test.js +1 -1
  43. package/source/parsePhoneNumberWithError.test.js +1 -1
@@ -1,78 +1,78 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and free environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a censorship-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- education, socio-economic status, nationality, personal appearance, race,
10
- religion, or sexual identity and orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating an open and free environment
15
- include:
16
-
17
- * Not constraining the language to be "welcoming" or "inclusive"
18
- * Not demanding show of empathy towards other community members
19
- * Not dictating anyone to be respectful of differing viewpoints and experiences
20
- * Not forcing anyone to change their views or opinions regardless of those
21
- * Not intimidating other people into accepting your own views or opinions
22
- * Not blackmailing other people to disclose their personal views or opinions
23
- * Not constraining other people from publishing their personal views or opinions in an unintrusive way
24
- * Focusing on what is best for the ecosystem
25
-
26
- Examples of acceptable behavior by participants include:
27
-
28
- * The use of sexualized language
29
- * Occasional trolling or insulting comments that are not completely off-topic
30
-
31
- Examples of unacceptable behavior by participants include:
32
-
33
- * Publishing others' private information, such as a physical or electronic address, without explicit permission
34
- * Unwelcome sexual attention or advances
35
- * Public harassment or personal attacks when carried out in an bold or intrusive way
36
- * Private harassment
37
- * Any actions that are in violation of the local laws or otherwise considered illegal
38
- * Other conduct which could reasonably be considered inappropriate in an open and free setting
39
-
40
- ## Our Responsibilities
41
-
42
- Project maintainers are responsible for clarifying the standards of acceptable
43
- behavior and are free to take appropriate and fair corrective action in
44
- response to any instances of unacceptable behavior.
45
-
46
- Project maintainers have the right and authority to remove, edit, or
47
- reject comments, commits, code, wiki edits, issues, and other contributions
48
- that are not aligned to this Code of Conduct, or to ban temporarily or
49
- permanently any contributor for other behaviors that they deem inappropriate,
50
- threatening, offensive, or harmful.
51
-
52
- ## Scope
53
-
54
- This Code of Conduct applies both within project spaces and in public spaces
55
- when an individual is representing the project or its community. Examples of
56
- representing a project or community include using an official project e-mail
57
- address, posting via an official social media account, or acting as an appointed
58
- representative at an online or offline event. Representation of a project may be
59
- further defined and clarified by project maintainers.
60
-
61
- ## Enforcement
62
-
63
- Instances of unacceptable behavior may be reported by contacting the project team.
64
- The complaints will likely be reviewed and investigated and may result in a response that
65
- is deemed necessary and appropriate to the circumstances. The project team should maintain confidentiality with regard to the reporter of an incident.
66
- Further details of specific enforcement policies may be posted separately.
67
-
68
- Project maintainers who do not follow the Code of Conduct in good
69
- faith may face temporary or permanent repercussions as determined by other
70
- members of the project's leadership.
71
-
72
- ## Attribution
73
-
74
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
75
- available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
76
-
77
- [homepage]: https://www.contributor-covenant.org
78
-
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and free environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a censorship-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ education, socio-economic status, nationality, personal appearance, race,
10
+ religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating an open and free environment
15
+ include:
16
+
17
+ * Not constraining the language to be "welcoming" or "inclusive"
18
+ * Not demanding show of empathy towards other community members
19
+ * Not dictating anyone to be respectful of differing viewpoints and experiences
20
+ * Not forcing anyone to change their views or opinions regardless of those
21
+ * Not intimidating other people into accepting your own views or opinions
22
+ * Not blackmailing other people to disclose their personal views or opinions
23
+ * Not constraining other people from publishing their personal views or opinions in an unintrusive way
24
+ * Focusing on what is best for the ecosystem
25
+
26
+ Examples of acceptable behavior by participants include:
27
+
28
+ * The use of sexualized language
29
+ * Occasional trolling or insulting comments that are not completely off-topic
30
+
31
+ Examples of unacceptable behavior by participants include:
32
+
33
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
34
+ * Unwelcome sexual attention or advances
35
+ * Public harassment or personal attacks when carried out in an bold or intrusive way
36
+ * Private harassment
37
+ * Any actions that are in violation of the local laws or otherwise considered illegal
38
+ * Other conduct which could reasonably be considered inappropriate in an open and free setting
39
+
40
+ ## Our Responsibilities
41
+
42
+ Project maintainers are responsible for clarifying the standards of acceptable
43
+ behavior and are free to take appropriate and fair corrective action in
44
+ response to any instances of unacceptable behavior.
45
+
46
+ Project maintainers have the right and authority to remove, edit, or
47
+ reject comments, commits, code, wiki edits, issues, and other contributions
48
+ that are not aligned to this Code of Conduct, or to ban temporarily or
49
+ permanently any contributor for other behaviors that they deem inappropriate,
50
+ threatening, offensive, or harmful.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies both within project spaces and in public spaces
55
+ when an individual is representing the project or its community. Examples of
56
+ representing a project or community include using an official project e-mail
57
+ address, posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event. Representation of a project may be
59
+ further defined and clarified by project maintainers.
60
+
61
+ ## Enforcement
62
+
63
+ Instances of unacceptable behavior may be reported by contacting the project team.
64
+ The complaints will likely be reviewed and investigated and may result in a response that
65
+ is deemed necessary and appropriate to the circumstances. The project team should maintain confidentiality with regard to the reporter of an incident.
66
+ Further details of specific enforcement policies may be posted separately.
67
+
68
+ Project maintainers who do not follow the Code of Conduct in good
69
+ faith may face temporary or permanent repercussions as determined by other
70
+ members of the project's leadership.
71
+
72
+ ## Attribution
73
+
74
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
75
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
76
+
77
+ [homepage]: https://www.contributor-covenant.org
78
+
@@ -65,29 +65,27 @@ var PhoneNumber = /*#__PURE__*/function () {
65
65
  // `constructor(countryOrCountryCallingCode, nationalNumber, metadata)`.
66
66
 
67
67
 
68
- if (typeof countryOrCountryCallingCode === 'string') {
69
- if (countryOrCountryCallingCode[0] === '+' && !nationalNumber) {
70
- throw new TypeError('`metadata` argument not passed');
71
- }
68
+ if (countryOrCountryCallingCode[0] === '+' && !nationalNumber) {
69
+ throw new TypeError('`metadata` argument not passed');
70
+ }
72
71
 
73
- if ((0, _isObject["default"])(nationalNumber) && (0, _isObject["default"])(nationalNumber.countries)) {
74
- metadata = nationalNumber;
75
- var e164Number = countryOrCountryCallingCode;
72
+ if ((0, _isObject["default"])(nationalNumber) && (0, _isObject["default"])(nationalNumber.countries)) {
73
+ metadata = nationalNumber;
74
+ var e164Number = countryOrCountryCallingCode;
76
75
 
77
- if (!E164_NUMBER_REGEXP.test(e164Number)) {
78
- throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');
79
- }
76
+ if (!E164_NUMBER_REGEXP.test(e164Number)) {
77
+ throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');
78
+ }
80
79
 
81
- var _extractCountryCallin = (0, _extractCountryCallingCode["default"])(e164Number, undefined, undefined, metadata),
82
- _countryCallingCode = _extractCountryCallin.countryCallingCode,
83
- number = _extractCountryCallin.number;
80
+ var _extractCountryCallin = (0, _extractCountryCallingCode["default"])(e164Number, undefined, undefined, metadata),
81
+ _countryCallingCode = _extractCountryCallin.countryCallingCode,
82
+ number = _extractCountryCallin.number;
84
83
 
85
- nationalNumber = number;
86
- countryOrCountryCallingCode = _countryCallingCode;
84
+ nationalNumber = number;
85
+ countryOrCountryCallingCode = _countryCallingCode;
87
86
 
88
- if (!nationalNumber) {
89
- throw new Error('Invalid `number` argument passed: too short');
90
- }
87
+ if (!nationalNumber) {
88
+ throw new Error('Invalid `number` argument passed: too short');
91
89
  }
92
90
  } // Validate `nationalNumber` argument.
93
91
 
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneNumber.js","names":["USE_NON_GEOGRAPHIC_COUNTRY_CODE","PhoneNumber","countryOrCountryCallingCode","nationalNumber","metadata","TypeError","isObject","countries","e164Number","E164_NUMBER_REGEXP","test","Error","extractCountryCallingCode","undefined","countryCallingCode","number","validateMetadata","getCountryAndCountryCallingCode","country","getMetadata","ext","getPossibleCountriesForNumber","isPossibleNumber","v2","isValidNumber","Metadata","isNonGeographicCallingCode","phoneNumber","getNumberType","format","options","formatNumber","isCountryCode","value","metadataJson","selectNumberingPlan"],"sources":["../source/PhoneNumber.js"],"sourcesContent":["import Metadata, { validateMetadata } from './metadata.js'\r\nimport isPossibleNumber from './isPossible.js'\r\nimport isValidNumber from './isValid.js'\r\n// import checkNumberLength from './helpers/checkNumberLength.js'\r\nimport getNumberType from './helpers/getNumberType.js'\r\nimport getPossibleCountriesForNumber from './helpers/getPossibleCountriesForNumber.js'\r\nimport extractCountryCallingCode from './helpers/extractCountryCallingCode.js'\r\nimport isObject from './helpers/isObject.js'\r\nimport formatNumber from './format.js'\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\nexport default class PhoneNumber {\r\n\t/**\r\n\t * @param {string} countryOrCountryCallingCode\r\n\t * @param {string} nationalNumber\r\n\t * @param {object} metadata — Metadata JSON\r\n\t * @return {PhoneNumber}\r\n\t */\r\n\tconstructor(countryOrCountryCallingCode, nationalNumber, metadata) {\r\n\t\t// Validate `countryOrCountryCallingCode` argument.\r\n\t\tif (!countryOrCountryCallingCode) {\r\n\t\t\tthrow new TypeError('First argument is required')\r\n\t\t}\r\n\t\tif (typeof countryOrCountryCallingCode !== 'string') {\r\n\t\t\tthrow new TypeError('First argument must be a string')\r\n\t\t}\r\n\r\n\t\t// In case of public API use: `constructor(number, metadata)`.\r\n\t\t// Transform the arguments from `constructor(number, metadata)` to\r\n\t\t// `constructor(countryOrCountryCallingCode, nationalNumber, metadata)`.\r\n\t\tif (typeof countryOrCountryCallingCode === 'string') {\r\n\t\t\tif (countryOrCountryCallingCode[0] === '+' && !nationalNumber) {\r\n\t\t\t\tthrow new TypeError('`metadata` argument not passed')\r\n\t\t\t}\r\n\t\t\tif (isObject(nationalNumber) && isObject(nationalNumber.countries)) {\r\n\t\t\t\tmetadata = nationalNumber\r\n\t\t\t\tconst e164Number = countryOrCountryCallingCode\r\n\t\t\t\tif (!E164_NUMBER_REGEXP.test(e164Number)) {\r\n\t\t\t\t\tthrow new Error('Invalid `number` argument passed: must consist of a \"+\" followed by digits')\r\n\t\t\t\t}\r\n\t\t\t\tconst { countryCallingCode, number } = extractCountryCallingCode(e164Number, undefined, undefined, metadata)\r\n\t\t\t\tnationalNumber = number\r\n\t\t\t\tcountryOrCountryCallingCode = countryCallingCode\r\n\t\t\t\tif (!nationalNumber) {\r\n\t\t\t\t\tthrow new Error('Invalid `number` argument passed: too short')\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Validate `nationalNumber` argument.\r\n\t\tif (!nationalNumber) {\r\n\t\t\tthrow new TypeError('`nationalNumber` argument is required')\r\n\t\t}\r\n\t\tif (typeof nationalNumber !== 'string') {\r\n\t\t\tthrow new TypeError('`nationalNumber` argument must be a string')\r\n\t\t}\r\n\r\n\t\t// Validate `metadata` argument.\r\n\t\tvalidateMetadata(metadata)\r\n\r\n\t\t// Initialize properties.\r\n\t\tconst { country, countryCallingCode } = getCountryAndCountryCallingCode(\r\n\t\t\tcountryOrCountryCallingCode,\r\n\t\t\tmetadata\r\n\t\t)\r\n\t\tthis.country = country\r\n\t\tthis.countryCallingCode = countryCallingCode\r\n\t\tthis.nationalNumber = nationalNumber\r\n\t\tthis.number = '+' + this.countryCallingCode + this.nationalNumber\r\n\t\t// Exclude `metadata` property output from `PhoneNumber.toString()`\r\n\t\t// so that it doesn't clutter the console output of Node.js.\r\n\t\t// Previously, when Node.js did `console.log(new PhoneNumber(...))`,\r\n\t\t// it would output the whole internal structure of the `metadata` object.\r\n\t\tthis.getMetadata = () => metadata\r\n\t}\r\n\r\n\tsetExt(ext) {\r\n\t\tthis.ext = ext\r\n\t}\r\n\r\n\tgetPossibleCountries() {\r\n\t\tif (this.country) {\r\n\t\t\treturn [this.country]\r\n\t\t}\r\n\t\treturn getPossibleCountriesForNumber(\r\n\t\t\tthis.countryCallingCode,\r\n\t\t\tthis.nationalNumber,\r\n\t\t\tthis.getMetadata()\r\n\t\t)\r\n\t}\r\n\r\n\tisPossible() {\r\n\t\treturn isPossibleNumber(this, { v2: true }, this.getMetadata())\r\n\t}\r\n\r\n\tisValid() {\r\n\t\treturn isValidNumber(this, { v2: true }, this.getMetadata())\r\n\t}\r\n\r\n\tisNonGeographic() {\r\n\t\tconst metadata = new Metadata(this.getMetadata())\r\n\t\treturn metadata.isNonGeographicCallingCode(this.countryCallingCode)\r\n\t}\r\n\r\n\tisEqual(phoneNumber) {\r\n\t\treturn this.number === phoneNumber.number && this.ext === phoneNumber.ext\r\n\t}\r\n\r\n\t// This function was originally meant to be an equivalent for `validatePhoneNumberLength()`,\r\n\t// but later it was found out that it doesn't include the possible `TOO_SHORT` result\r\n\t// returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`,\r\n\t// so eventually I simply commented out this method from the `PhoneNumber` class\r\n\t// and just left the `validatePhoneNumberLength()` function, even though that one would require\r\n\t// and additional step to also validate the actual country / calling code of the phone number.\r\n\t// validateLength() {\r\n\t// \tconst metadata = new Metadata(this.getMetadata())\r\n\t// \tmetadata.selectNumberingPlan(this.countryCallingCode)\r\n\t// \tconst result = checkNumberLength(this.nationalNumber, metadata)\r\n\t// \tif (result !== 'IS_POSSIBLE') {\r\n\t// \t\treturn result\r\n\t// \t}\r\n\t// }\r\n\r\n\tgetType() {\r\n\t\treturn getNumberType(this, { v2: true }, this.getMetadata())\r\n\t}\r\n\r\n\tformat(format, options) {\r\n\t\treturn formatNumber(\r\n\t\t\tthis,\r\n\t\t\tformat,\r\n\t\t\toptions ? { ...options, v2: true } : { v2: true },\r\n\t\t\tthis.getMetadata()\r\n\t\t)\r\n\t}\r\n\r\n\tformatNational(options) {\r\n\t\treturn this.format('NATIONAL', options)\r\n\t}\r\n\r\n\tformatInternational(options) {\r\n\t\treturn this.format('INTERNATIONAL', options)\r\n\t}\r\n\r\n\tgetURI(options) {\r\n\t\treturn this.format('RFC3966', options)\r\n\t}\r\n}\r\n\r\nconst isCountryCode = (value) => /^[A-Z]{2}$/.test(value)\r\n\r\nfunction getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJson) {\r\n\tlet country\r\n\tlet countryCallingCode\r\n\r\n\tconst metadata = new Metadata(metadataJson)\r\n\t// If country code is passed then derive `countryCallingCode` from it.\r\n\t// Also store the country code as `.country`.\r\n\tif (isCountryCode(countryOrCountryCallingCode)) {\r\n\t\tcountry = countryOrCountryCallingCode\r\n\t\tmetadata.selectNumberingPlan(country)\r\n\t\tcountryCallingCode = metadata.countryCallingCode()\r\n\t} else {\r\n\t\tcountryCallingCode = countryOrCountryCallingCode\r\n\t\t/* istanbul ignore if */\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\tif (metadata.isNonGeographicCallingCode(countryCallingCode)) {\r\n\t\t\t\tcountry = '001'\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\t\tcountry,\r\n\t\tcountryCallingCode\r\n\t}\r\n}\r\n\r\nconst E164_NUMBER_REGEXP = /^\\+\\d+$/"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,+BAA+B,GAAG,KAAxC;;IAEqBC,W;EACpB;AACD;AACA;AACA;AACA;AACA;EACC,qBAAYC,2BAAZ,EAAyCC,cAAzC,EAAyDC,QAAzD,EAAmE;IAAA;;IAClE;IACA,IAAI,CAACF,2BAAL,EAAkC;MACjC,MAAM,IAAIG,SAAJ,CAAc,4BAAd,CAAN;IACA;;IACD,IAAI,OAAOH,2BAAP,KAAuC,QAA3C,EAAqD;MACpD,MAAM,IAAIG,SAAJ,CAAc,iCAAd,CAAN;IACA,CAPiE,CASlE;IACA;IACA;;;IACA,IAAI,OAAOH,2BAAP,KAAuC,QAA3C,EA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AED,IAAML,kBAAkB,GAAG,SAA3B"}
1
+ {"version":3,"file":"PhoneNumber.js","names":["USE_NON_GEOGRAPHIC_COUNTRY_CODE","PhoneNumber","countryOrCountryCallingCode","nationalNumber","metadata","TypeError","isObject","countries","e164Number","E164_NUMBER_REGEXP","test","Error","extractCountryCallingCode","undefined","countryCallingCode","number","validateMetadata","getCountryAndCountryCallingCode","country","getMetadata","ext","getPossibleCountriesForNumber","isPossibleNumber","v2","isValidNumber","Metadata","isNonGeographicCallingCode","phoneNumber","getNumberType","format","options","formatNumber","isCountryCode","value","metadataJson","selectNumberingPlan"],"sources":["../source/PhoneNumber.js"],"sourcesContent":["import Metadata, { validateMetadata } from './metadata.js'\r\nimport isPossibleNumber from './isPossible.js'\r\nimport isValidNumber from './isValid.js'\r\n// import checkNumberLength from './helpers/checkNumberLength.js'\r\nimport getNumberType from './helpers/getNumberType.js'\r\nimport getPossibleCountriesForNumber from './helpers/getPossibleCountriesForNumber.js'\r\nimport extractCountryCallingCode from './helpers/extractCountryCallingCode.js'\r\nimport isObject from './helpers/isObject.js'\r\nimport formatNumber from './format.js'\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\nexport default class PhoneNumber {\r\n\t/**\r\n\t * @param {string} countryOrCountryCallingCode\r\n\t * @param {string} nationalNumber\r\n\t * @param {object} metadata — Metadata JSON\r\n\t * @return {PhoneNumber}\r\n\t */\r\n\tconstructor(countryOrCountryCallingCode, nationalNumber, metadata) {\r\n\t\t// Validate `countryOrCountryCallingCode` argument.\r\n\t\tif (!countryOrCountryCallingCode) {\r\n\t\t\tthrow new TypeError('First argument is required')\r\n\t\t}\r\n\t\tif (typeof countryOrCountryCallingCode !== 'string') {\r\n\t\t\tthrow new TypeError('First argument must be a string')\r\n\t\t}\r\n\r\n\t\t// In case of public API use: `constructor(number, metadata)`.\r\n\t\t// Transform the arguments from `constructor(number, metadata)` to\r\n\t\t// `constructor(countryOrCountryCallingCode, nationalNumber, metadata)`.\r\n\t\tif (countryOrCountryCallingCode[0] === '+' && !nationalNumber) {\r\n\t\t\tthrow new TypeError('`metadata` argument not passed')\r\n\t\t}\r\n\t\tif (isObject(nationalNumber) && isObject(nationalNumber.countries)) {\r\n\t\t\tmetadata = nationalNumber\r\n\t\t\tconst e164Number = countryOrCountryCallingCode\r\n\t\t\tif (!E164_NUMBER_REGEXP.test(e164Number)) {\r\n\t\t\t\tthrow new Error('Invalid `number` argument passed: must consist of a \"+\" followed by digits')\r\n\t\t\t}\r\n\t\t\tconst { countryCallingCode, number } = extractCountryCallingCode(e164Number, undefined, undefined, metadata)\r\n\t\t\tnationalNumber = number\r\n\t\t\tcountryOrCountryCallingCode = countryCallingCode\r\n\t\t\tif (!nationalNumber) {\r\n\t\t\t\tthrow new Error('Invalid `number` argument passed: too short')\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Validate `nationalNumber` argument.\r\n\t\tif (!nationalNumber) {\r\n\t\t\tthrow new TypeError('`nationalNumber` argument is required')\r\n\t\t}\r\n\t\tif (typeof nationalNumber !== 'string') {\r\n\t\t\tthrow new TypeError('`nationalNumber` argument must be a string')\r\n\t\t}\r\n\r\n\t\t// Validate `metadata` argument.\r\n\t\tvalidateMetadata(metadata)\r\n\r\n\t\t// Initialize properties.\r\n\t\tconst { country, countryCallingCode } = getCountryAndCountryCallingCode(\r\n\t\t\tcountryOrCountryCallingCode,\r\n\t\t\tmetadata\r\n\t\t)\r\n\t\tthis.country = country\r\n\t\tthis.countryCallingCode = countryCallingCode\r\n\t\tthis.nationalNumber = nationalNumber\r\n\t\tthis.number = '+' + this.countryCallingCode + this.nationalNumber\r\n\t\t// Exclude `metadata` property output from `PhoneNumber.toString()`\r\n\t\t// so that it doesn't clutter the console output of Node.js.\r\n\t\t// Previously, when Node.js did `console.log(new PhoneNumber(...))`,\r\n\t\t// it would output the whole internal structure of the `metadata` object.\r\n\t\tthis.getMetadata = () => metadata\r\n\t}\r\n\r\n\tsetExt(ext) {\r\n\t\tthis.ext = ext\r\n\t}\r\n\r\n\tgetPossibleCountries() {\r\n\t\tif (this.country) {\r\n\t\t\treturn [this.country]\r\n\t\t}\r\n\t\treturn getPossibleCountriesForNumber(\r\n\t\t\tthis.countryCallingCode,\r\n\t\t\tthis.nationalNumber,\r\n\t\t\tthis.getMetadata()\r\n\t\t)\r\n\t}\r\n\r\n\tisPossible() {\r\n\t\treturn isPossibleNumber(this, { v2: true }, this.getMetadata())\r\n\t}\r\n\r\n\tisValid() {\r\n\t\treturn isValidNumber(this, { v2: true }, this.getMetadata())\r\n\t}\r\n\r\n\tisNonGeographic() {\r\n\t\tconst metadata = new Metadata(this.getMetadata())\r\n\t\treturn metadata.isNonGeographicCallingCode(this.countryCallingCode)\r\n\t}\r\n\r\n\tisEqual(phoneNumber) {\r\n\t\treturn this.number === phoneNumber.number && this.ext === phoneNumber.ext\r\n\t}\r\n\r\n\t// This function was originally meant to be an equivalent for `validatePhoneNumberLength()`,\r\n\t// but later it was found out that it doesn't include the possible `TOO_SHORT` result\r\n\t// returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`,\r\n\t// so eventually I simply commented out this method from the `PhoneNumber` class\r\n\t// and just left the `validatePhoneNumberLength()` function, even though that one would require\r\n\t// and additional step to also validate the actual country / calling code of the phone number.\r\n\t// validateLength() {\r\n\t// \tconst metadata = new Metadata(this.getMetadata())\r\n\t// \tmetadata.selectNumberingPlan(this.countryCallingCode)\r\n\t// \tconst result = checkNumberLength(this.nationalNumber, metadata)\r\n\t// \tif (result !== 'IS_POSSIBLE') {\r\n\t// \t\treturn result\r\n\t// \t}\r\n\t// }\r\n\r\n\tgetType() {\r\n\t\treturn getNumberType(this, { v2: true }, this.getMetadata())\r\n\t}\r\n\r\n\tformat(format, options) {\r\n\t\treturn formatNumber(\r\n\t\t\tthis,\r\n\t\t\tformat,\r\n\t\t\toptions ? { ...options, v2: true } : { v2: true },\r\n\t\t\tthis.getMetadata()\r\n\t\t)\r\n\t}\r\n\r\n\tformatNational(options) {\r\n\t\treturn this.format('NATIONAL', options)\r\n\t}\r\n\r\n\tformatInternational(options) {\r\n\t\treturn this.format('INTERNATIONAL', options)\r\n\t}\r\n\r\n\tgetURI(options) {\r\n\t\treturn this.format('RFC3966', options)\r\n\t}\r\n}\r\n\r\nconst isCountryCode = (value) => /^[A-Z]{2}$/.test(value)\r\n\r\nfunction getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJson) {\r\n\tlet country\r\n\tlet countryCallingCode\r\n\r\n\tconst metadata = new Metadata(metadataJson)\r\n\t// If country code is passed then derive `countryCallingCode` from it.\r\n\t// Also store the country code as `.country`.\r\n\tif (isCountryCode(countryOrCountryCallingCode)) {\r\n\t\tcountry = countryOrCountryCallingCode\r\n\t\tmetadata.selectNumberingPlan(country)\r\n\t\tcountryCallingCode = metadata.countryCallingCode()\r\n\t} else {\r\n\t\tcountryCallingCode = countryOrCountryCallingCode\r\n\t\t/* istanbul ignore if */\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\tif (metadata.isNonGeographicCallingCode(countryCallingCode)) {\r\n\t\t\t\tcountry = '001'\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\t\tcountry,\r\n\t\tcountryCallingCode\r\n\t}\r\n}\r\n\r\nconst E164_NUMBER_REGEXP = /^\\+\\d+$/"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,+BAA+B,GAAG,KAAxC;;IAEqBC,W;EACpB;AACD;AACA;AACA;AACA;AACA;EACC,qBAAYC,2BAAZ,EAAyCC,cAAzC,EAAyDC,QAAzD,EAAmE;IAAA;;IAClE;IACA,IAAI,CAACF,2BAAL,EAAkC;MACjC,MAAM,IAAIG,SAAJ,CAAc,4BAAd,CAAN;IACA;;IACD,IAAI,OAAOH,2BAAP,KAAuC,QAA3C,EAAqD;MACpD,MAAM,IAAI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ADM;IAENJ,kBAAkB,EAAlBA;EAFM,CAAP;AAIA;;AAED,IAAML,kBAAkB,GAAG,SAA3B"}
@@ -31,6 +31,12 @@ describe('PhoneNumber', function () {
31
31
  expect(function () {
32
32
  return new _PhoneNumber["default"]('+7800');
33
33
  }).to["throw"]('`metadata` argument not passed');
34
+ expect(function () {
35
+ return new _PhoneNumber["default"](1234567890);
36
+ }).to["throw"]('must be a string');
37
+ expect(function () {
38
+ return new _PhoneNumber["default"]('+1', 1234567890);
39
+ }).to["throw"]('must be a string');
34
40
  });
35
41
  it('should validate constructor arguments (private constructor)', function () {
36
42
  expect(function () {
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneNumber.test.js","names":["describe","it","phoneNumber","PhoneNumber","metadata","setExt","expect","country","to","be","undefined","countryCallingCode","should","equal","nationalNumber","formatNational","number","ext","format","formatExtension","extension","isEqual","isNonGeographic","getPossibleCountries","deep","indexOf","length"],"sources":["../source/PhoneNumber.test.js"],"sourcesContent":["import metadata from '../metadata.min.json' assert { type: 'json' }\r\nimport PhoneNumber from './PhoneNumber.js'\r\n\r\ndescribe('PhoneNumber', () => {\r\n\tit('should create a phone number via a public constructor', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('+78005553535', metadata)\r\n\t\tphoneNumber.setExt('1234')\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.countryCallingCode.should.equal('7')\r\n\t\tphoneNumber.nationalNumber.should.equal('8005553535')\r\n\t\tphoneNumber.formatNational().should.equal('8 (800) 555-35-35 ext. 1234')\r\n\t})\r\n\r\n\tit('should validate constructor arguments (public constructor)', () => {\r\n\t\texpect(() => new PhoneNumber()).to.throw('argument is required')\r\n\t\texpect(() => new PhoneNumber(undefined, metadata)).to.throw('argument is required')\r\n\t\texpect(() => new PhoneNumber('7', metadata)).to.throw('must consist of a \"+\"')\r\n\t\texpect(() => new PhoneNumber('+7', metadata)).to.throw('too short')\r\n\t\texpect(() => new PhoneNumber('+7800')).to.throw('`metadata` argument not passed')\r\n\t})\r\n\r\n\tit('should validate constructor arguments (private constructor)', () => {\r\n\t\texpect(() => new PhoneNumber(undefined, '800', metadata)).to.throw('First argument is required')\r\n\t\texpect(() => new PhoneNumber('7', undefined, metadata)).to.throw('`nationalNumber` argument is required')\r\n\t\texpect(() => new PhoneNumber('7', '8005553535')).to.throw('`metadata` argument not passed')\r\n\t})\r\n\r\n\tit('should accept country code argument', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('RU', '8005553535', metadata)\r\n\t\tphoneNumber.countryCallingCode.should.equal('7')\r\n\t\tphoneNumber.country.should.equal('RU')\r\n\t\tphoneNumber.number.should.equal('+78005553535')\r\n\t})\r\n\r\n\tit('should format number with options', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('7', '8005553535', metadata)\r\n\t\tphoneNumber.ext = '123'\r\n\t\tphoneNumber.format('NATIONAL', {\r\n\t\t\tformatExtension: (number, extension) => `${number} доб. ${extension}`\r\n\t\t})\r\n\t\t.should.equal('8 (800) 555-35-35 доб. 123')\r\n\t})\r\n\r\n\tit('should compare phone numbers', () => {\r\n\t\tnew PhoneNumber('RU', '8005553535', metadata).isEqual(new PhoneNumber('RU', '8005553535', metadata)).should.equal(true)\r\n\t\tnew PhoneNumber('RU', '8005553535', metadata).isEqual(new PhoneNumber('7', '8005553535', metadata)).should.equal(true)\r\n\t\tnew PhoneNumber('RU', '8005553535', metadata).isEqual(new PhoneNumber('RU', '8005553536', metadata)).should.equal(false)\r\n\t})\r\n\r\n\tit('should tell if a number is non-geographic', () => {\r\n\t\tnew PhoneNumber('7', '8005553535', metadata).isNonGeographic().should.equal(false)\r\n\t\tnew PhoneNumber('870', '773111632', metadata).isNonGeographic().should.equal(true)\r\n\t})\r\n\r\n\tit('should allow setting extension', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('1', '2133734253', metadata)\r\n\t\tphoneNumber.setExt('1234')\r\n\t\tphoneNumber.ext.should.equal('1234')\r\n\t\tphoneNumber.formatNational().should.equal('(213) 373-4253 ext. 1234')\r\n\t})\r\n\r\n\tit('should return possible countries', () => {\r\n // \"599\": [\r\n // \"CW\", // \"possible_lengths\": [7, 8]\r\n // \"BQ\" // \"possible_lengths\": [7]\r\n // ]\r\n\r\n\t\tlet phoneNumber = new PhoneNumber('599', '123456', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\r\n\t\tphoneNumber = new PhoneNumber('599', '1234567', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal(['CW', 'BQ'])\r\n\r\n\t\tphoneNumber = new PhoneNumber('599', '12345678', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal(['CW'])\r\n\r\n\t\tphoneNumber = new PhoneNumber('599', '123456789', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\t})\r\n\r\n\tit('should return possible countries in case of ambiguity', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('1', '2223334444', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().indexOf('US').should.equal(0)\r\n\t\tphoneNumber.getPossibleCountries().length.should.equal(25)\r\n\t})\r\n\r\n\t// it('should return empty possible countries when no national number has been input', () => {\r\n\t// \tconst phoneNumber = new PhoneNumber('1', '', metadata)\r\n\t// \texpect(phoneNumber.country).to.be.undefined\r\n\t// \tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\t// })\r\n\r\n\tit('should return empty possible countries when not enough national number digits have been input', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('1', '222', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\t})\r\n\r\n\tit('should return possible countries in case of no ambiguity', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('US', '2133734253', metadata)\r\n\t\tphoneNumber.country.should.equal('US')\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal(['US'])\r\n\t})\r\n\r\n\tit('should return empty possible countries in case of an unknown calling code', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('777', '123', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\t})\r\n\r\n\t// it('should validate phone number length', () => {\r\n\t// \tconst phoneNumber = new PhoneNumber('RU', '800', metadata)\r\n\t// \texpect(phoneNumber.validateLength()).to.equal('TOO_SHORT')\r\n\t//\r\n\t// \tconst phoneNumberValid = new PhoneNumber('RU', '8005553535', metadata)\r\n\t// \texpect(phoneNumberValid.validateLength()).to.be.undefined\r\n\t// })\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEAA,QAAQ,CAAC,aAAD,EAAgB,YAAM;EAC7BC,EAAE,CAAC,uDAAD,EAA0D,YAAM;IACjE,IAAMC,WAAW,GAAG,IAAIC,uBAAJ,CAAgB,cAAhB,EAAgCC,uBAAhC,CAApB;IACAF,WAAW,CAACG,MAAZ,CAAmB,MAAnB;IACAC,MAAM,CAACJ,WAAW,CAACK,OAAb,CAAN,CAA4BC,EAA5B,CAA+BC,EAA/B,CAAkCC,SAAlC;IACAR,WAAW,CAACS,kBAAZ,CAA+BC,MAA/B,CAAsCC,KAAtC,CAA4C,GAA5C;IACAX,WAAW,CAACY,cAAZ,CAA2BF,MAA3B,CAAkCC,KAAlC,CAAwC,YAAxC;IACAX,WAAW,CAACa,cAAZ,GAA6BH,MAA7B,CAAoCC,KAApC,CAA0C,6BAA1C;EACA,CAPC,CAAF;EASAZ,EAAE,CAAC,4DAAD,EAA+D,YAAM;IACtEK,MAAM,CAAC;MAAA,OAAM,IAAIH,uBAAJ,EAAN;IAAA,CAAD,CAAN,CAAgCK,EAAhC,UAAyC,sBAAzC;IACAF,MAAM,CAAC;MAAA,OAAM,I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oBAAZ,GAAmCX,MAAnC,CAA0CY,IAA1C,CAA+CX,KAA/C,CAAqD,EAArD;EACA,CAJC,CAAF;EAMAZ,EAAE,CAAC,0DAAD,EAA6D,YAAM;IACpE,IAAMC,WAAW,GAAG,IAAIC,uBAAJ,CAAgB,IAAhB,EAAsB,YAAtB,EAAoCC,uBAApC,CAApB;IACAF,WAAW,CAACK,OAAZ,CAAoBK,MAApB,CAA2BC,KAA3B,CAAiC,IAAjC;IACAX,WAAW,CAACqB,oBAAZ,GAAmCX,MAAnC,CAA0CY,IAA1C,CAA+CX,KAA/C,CAAqD,CAAC,IAAD,CAArD;EACA,CAJC,CAAF;EAMAZ,EAAE,CAAC,2EAAD,EAA8E,YAAM;IACrF,IAAMC,WAAW,GAAG,IAAIC,uBAAJ,CAAgB,KAAhB,EAAuB,KAAvB,EAA8BC,uBAA9B,CAApB;IACAE,MAAM,CAACJ,WAAW,CAACK,OAAb,CAAN,CAA4BC,EAA5B,CAA+BC,EAA/B,CAAkCC,SAAlC;IACAR,WAAW,CAACqB,oBAAZ,GAAmCX,MAAnC,CAA0CY,IAA1C,CAA+CX,KAA/C,CAAqD,EAArD;EACA,CAJC,CAAF,CA1G6B,CAgH7B;EACA;EACA;EACA;EACA;EACA;EACA;AACA,CAvHO,CAAR"}
1
+ {"version":3,"file":"PhoneNumber.test.js","names":["describe","it","phoneNumber","PhoneNumber","metadata","setExt","expect","country","to","be","undefined","countryCallingCode","should","equal","nationalNumber","formatNational","number","ext","format","formatExtension","extension","isEqual","isNonGeographic","getPossibleCountries","deep","indexOf","length"],"sources":["../source/PhoneNumber.test.js"],"sourcesContent":["import metadata from '../metadata.min.json' assert { type: 'json' }\r\nimport PhoneNumber from './PhoneNumber.js'\r\n\r\ndescribe('PhoneNumber', () => {\r\n\tit('should create a phone number via a public constructor', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('+78005553535', metadata)\r\n\t\tphoneNumber.setExt('1234')\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.countryCallingCode.should.equal('7')\r\n\t\tphoneNumber.nationalNumber.should.equal('8005553535')\r\n\t\tphoneNumber.formatNational().should.equal('8 (800) 555-35-35 ext. 1234')\r\n\t})\r\n\r\n\tit('should validate constructor arguments (public constructor)', () => {\r\n\t\texpect(() => new PhoneNumber()).to.throw('argument is required')\r\n\t\texpect(() => new PhoneNumber(undefined, metadata)).to.throw('argument is required')\r\n\t\texpect(() => new PhoneNumber('7', metadata)).to.throw('must consist of a \"+\"')\r\n\t\texpect(() => new PhoneNumber('+7', metadata)).to.throw('too short')\r\n\t\texpect(() => new PhoneNumber('+7800')).to.throw('`metadata` argument not passed')\r\n\t\texpect(() => new PhoneNumber(1234567890)).to.throw('must be a string')\r\n\t\texpect(() => new PhoneNumber('+1', 1234567890)).to.throw('must be a string')\r\n\t})\r\n\r\n\tit('should validate constructor arguments (private constructor)', () => {\r\n\t\texpect(() => new PhoneNumber(undefined, '800', metadata)).to.throw('First argument is required')\r\n\t\texpect(() => new PhoneNumber('7', undefined, metadata)).to.throw('`nationalNumber` argument is required')\r\n\t\texpect(() => new PhoneNumber('7', '8005553535')).to.throw('`metadata` argument not passed')\r\n\t})\r\n\r\n\tit('should accept country code argument', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('RU', '8005553535', metadata)\r\n\t\tphoneNumber.countryCallingCode.should.equal('7')\r\n\t\tphoneNumber.country.should.equal('RU')\r\n\t\tphoneNumber.number.should.equal('+78005553535')\r\n\t})\r\n\r\n\tit('should format number with options', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('7', '8005553535', metadata)\r\n\t\tphoneNumber.ext = '123'\r\n\t\tphoneNumber.format('NATIONAL', {\r\n\t\t\tformatExtension: (number, extension) => `${number} доб. ${extension}`\r\n\t\t})\r\n\t\t.should.equal('8 (800) 555-35-35 доб. 123')\r\n\t})\r\n\r\n\tit('should compare phone numbers', () => {\r\n\t\tnew PhoneNumber('RU', '8005553535', metadata).isEqual(new PhoneNumber('RU', '8005553535', metadata)).should.equal(true)\r\n\t\tnew PhoneNumber('RU', '8005553535', metadata).isEqual(new PhoneNumber('7', '8005553535', metadata)).should.equal(true)\r\n\t\tnew PhoneNumber('RU', '8005553535', metadata).isEqual(new PhoneNumber('RU', '8005553536', metadata)).should.equal(false)\r\n\t})\r\n\r\n\tit('should tell if a number is non-geographic', () => {\r\n\t\tnew PhoneNumber('7', '8005553535', metadata).isNonGeographic().should.equal(false)\r\n\t\tnew PhoneNumber('870', '773111632', metadata).isNonGeographic().should.equal(true)\r\n\t})\r\n\r\n\tit('should allow setting extension', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('1', '2133734253', metadata)\r\n\t\tphoneNumber.setExt('1234')\r\n\t\tphoneNumber.ext.should.equal('1234')\r\n\t\tphoneNumber.formatNational().should.equal('(213) 373-4253 ext. 1234')\r\n\t})\r\n\r\n\tit('should return possible countries', () => {\r\n // \"599\": [\r\n // \"CW\", // \"possible_lengths\": [7, 8]\r\n // \"BQ\" // \"possible_lengths\": [7]\r\n // ]\r\n\r\n\t\tlet phoneNumber = new PhoneNumber('599', '123456', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\r\n\t\tphoneNumber = new PhoneNumber('599', '1234567', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal(['CW', 'BQ'])\r\n\r\n\t\tphoneNumber = new PhoneNumber('599', '12345678', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal(['CW'])\r\n\r\n\t\tphoneNumber = new PhoneNumber('599', '123456789', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\t})\r\n\r\n\tit('should return possible countries in case of ambiguity', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('1', '2223334444', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().indexOf('US').should.equal(0)\r\n\t\tphoneNumber.getPossibleCountries().length.should.equal(25)\r\n\t})\r\n\r\n\t// it('should return empty possible countries when no national number has been input', () => {\r\n\t// \tconst phoneNumber = new PhoneNumber('1', '', metadata)\r\n\t// \texpect(phoneNumber.country).to.be.undefined\r\n\t// \tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\t// })\r\n\r\n\tit('should return empty possible countries when not enough national number digits have been input', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('1', '222', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\t})\r\n\r\n\tit('should return possible countries in case of no ambiguity', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('US', '2133734253', metadata)\r\n\t\tphoneNumber.country.should.equal('US')\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal(['US'])\r\n\t})\r\n\r\n\tit('should return empty possible countries in case of an unknown calling code', () => {\r\n\t\tconst phoneNumber = new PhoneNumber('777', '123', metadata)\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.getPossibleCountries().should.deep.equal([])\r\n\t})\r\n\r\n\t// it('should validate phone number length', () => {\r\n\t// \tconst phoneNumber = new PhoneNumber('RU', '800', metadata)\r\n\t// \texpect(phoneNumber.validateLength()).to.equal('TOO_SHORT')\r\n\t//\r\n\t// \tconst phoneNumberValid = new PhoneNumber('RU', '8005553535', metadata)\r\n\t// \texpect(phoneNumberValid.validateLength()).to.be.undefined\r\n\t// })\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEAA,QAAQ,CAAC,aAAD,EAAgB,YAAM;EAC7BC,EAAE,CAAC,uDAAD,EAA0D,YAAM;IACjE,IAAMC,WAAW,GAAG,IAAIC,uBAAJ,CAAgB,cAAhB,EAAgCC,uBAAhC,CAApB;IACAF,WAAW,CAACG,MAAZ,CAAmB,MAAnB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B,KAAhB,EAAuB,KAAvB,EAA8BC,uBAA9B,CAApB;IACAE,MAAM,CAACJ,WAAW,CAACK,OAAb,CAAN,CAA4BC,EAA5B,CAA+BC,EAA/B,CAAkCC,SAAlC;IACAR,WAAW,CAACqB,oBAAZ,GAAmCX,MAAnC,CAA0CY,IAA1C,CAA+CX,KAA/C,CAAqD,EAArD;EACA,CAJC,CAAF,CA5G6B,CAkH7B;EACA;EACA;EACA;EACA;EACA;EACA;AACA,CAzHO,CAAR"}
@@ -152,7 +152,7 @@ describe('parse', function () {
152
152
  parseNumber('+7 (800) 55-35-35', {
153
153
  extended: true
154
154
  }).should.deep.equal({
155
- country: 'RU',
155
+ country: undefined,
156
156
  countryCallingCode: '7',
157
157
  phone: '800553535',
158
158
  carrierCode: undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"parse.test.js","names":["parseNumber","parameters","push","metadata","_parseNumber","apply","USE_NON_GEOGRAPHIC_COUNTRY_CODE","describe","it","should","deep","equal","defaultCountry","country","phone","extended","countryCallingCode","carrierCode","undefined","ext","valid","possible","thrower","defaultCallingCode","expect","to","be","v2"],"sources":["../../source/legacy/parse.test.js"],"sourcesContent":["import metadata from '../../metadata.min.json' assert { type: 'json' }\r\nimport _parseNumber from './parse.js'\r\nimport Metadata from '../metadata.js'\r\n\r\nfunction parseNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _parseNumber.apply(this, parameters)\r\n}\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\ndescribe('parse', () => {\r\n\tit('should not parse invalid phone numbers', () => {\r\n\t\t// Too short.\r\n\t\tparseNumber('+7 (800) 55-35-35').should.deep.equal({})\r\n\t\t// Too long.\r\n\t\tparseNumber('+7 (800) 55-35-35-55').should.deep.equal({})\r\n\r\n\t\tparseNumber('+7 (800) 55-35-35', 'US').should.deep.equal({})\r\n\t\tparseNumber('(800) 55 35 35', { defaultCountry: 'RU' }).should.deep.equal({})\r\n\t\tparseNumber('+1 187 215 5230', 'US').should.deep.equal({})\r\n\r\n\t\tparseNumber('911231231', 'BE').should.deep.equal({})\r\n\t})\r\n\r\n\tit('should parse valid phone numbers', () => {\r\n\t\t// Instant loans\r\n\t\t// https://www.youtube.com/watch?v=6e1pMrYH5jI\r\n\t\t//\r\n\t\t// Restrict to RU\r\n\t\tparseNumber('Phone: 8 (800) 555 35 35.', 'RU').should.deep.equal({ country: 'RU', phone: '8005553535' })\r\n\t\t// International format\r\n\t\tparseNumber('Phone: +7 (800) 555-35-35.').should.deep.equal({ country: 'RU', phone: '8005553535' })\r\n\t\t// // Restrict to US, but not a US country phone code supplied\r\n\t\t// parseNumber('+7 (800) 555-35-35', 'US').should.deep.equal({})\r\n\t\t// Restrict to RU\r\n\t\tparseNumber('(800) 555 35 35', 'RU').should.deep.equal({ country: 'RU', phone: '8005553535' })\r\n\t\t// Default to RU\r\n\t\tparseNumber('8 (800) 555 35 35', { defaultCountry: 'RU' }).should.deep.equal({ country: 'RU', phone: '8005553535' })\r\n\r\n\t\t// Gangster partyline\r\n\t\tparseNumber('+1-213-373-4253').should.deep.equal({ country: 'US', phone: '2133734253' })\r\n\r\n\t\t// Switzerland (just in case)\r\n\t\tparseNumber('044 668 18 00', 'CH').should.deep.equal({ country: 'CH', phone: '446681800' })\r\n\r\n\t\t// China, Beijing\r\n\t\tparseNumber('010-852644821', 'CN').should.deep.equal({ country: 'CN', phone: '10852644821' })\r\n\r\n\t\t// France\r\n\t\tparseNumber('+33169454850').should.deep.equal({ country: 'FR', phone: '169454850' })\r\n\r\n\t\t// UK (Jersey)\r\n\t\tparseNumber('+44 7700 300000').should.deep.equal({ country: 'JE', phone: '7700300000' })\r\n\r\n\t\t// KZ\r\n\t\tparseNumber('+7 702 211 1111').should.deep.equal({ country: 'KZ', phone: '7022111111' })\r\n\r\n\t\t// Brazil\r\n\t\tparseNumber('11987654321', 'BR').should.deep.equal({ country: 'BR', phone: '11987654321' })\r\n\r\n\t\t// Long country phone code.\r\n\t\tparseNumber('+212659777777').should.deep.equal({ country: 'MA', phone: '659777777' })\r\n\r\n\t\t// No country could be derived.\r\n\t\t// parseNumber('+212569887076').should.deep.equal({ countryPhoneCode: '212', phone: '569887076' })\r\n\r\n\t\t// GB. Moible numbers starting 07624* are Isle of Man.\r\n\t\tparseNumber('07624369230', 'GB').should.deep.equal({ country: 'IM', phone: '7624369230' })\r\n\t})\r\n\r\n\tit('should parse possible numbers', () => {\r\n\t\t// Invalid phone number for a given country.\r\n\t\tparseNumber('1112223344', 'RU', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tcountryCallingCode : '7',\r\n\t\t\tphone : '1112223344',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\r\n\t\t// International phone number.\r\n\t\t// Several countries with the same country phone code.\r\n\t\tparseNumber('+71112223344').should.deep.equal({})\r\n\t\tparseNumber('+71112223344', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : undefined,\r\n\t\t\tcountryCallingCode : '7',\r\n\t\t\tphone : '1112223344',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\r\n\t\t// International phone number.\r\n\t\t// Single country with the given country phone code.\r\n\t\tparseNumber('+33011222333', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'FR',\r\n\t\t\tcountryCallingCode : '33',\r\n\t\t\tphone : '011222333',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\r\n\t\t// Too short.\r\n\t\t// Won't strip national prefix `8` because otherwise the number would be too short.\r\n\t\tparseNumber('+7 (800) 55-35-35', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tcountryCallingCode : '7',\r\n\t\t\tphone : '800553535',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : false\r\n\t\t})\r\n\r\n\t\t// Too long.\r\n\t\tparseNumber('+1 213 37342530', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : undefined,\r\n\t\t\tcountryCallingCode : '1',\r\n\t\t\tphone : '21337342530',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : false\r\n\t\t})\r\n\r\n\t\t// No national number to be parsed.\r\n\t\tparseNumber('+996', { extended: true }).should.deep.equal({\r\n\t\t\t// countryCallingCode : '996'\r\n\t\t})\r\n\r\n\t\t// Valid number.\r\n\t\tparseNumber('+78005553535', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tcountryCallingCode : '7',\r\n\t\t\tphone : '8005553535',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : true,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/211\r\n\t\tparseNumber('+966', { extended: true }).should.deep.equal({})\r\n\t\tparseNumber('+9664', { extended: true }).should.deep.equal({})\r\n\t\tparseNumber('+96645', { extended: true }).should.deep.equal({\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\tphone : '45',\r\n\t\t\text : undefined,\r\n\t\t\tcountry : 'SA',\r\n\t\t\tcountryCallingCode : '966',\r\n\t\t\tpossible : false,\r\n\t\t\tvalid : false\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse non-European digits', () => {\r\n\t\tparseNumber('+١٢١٢٢٣٢٣٢٣٢').should.deep.equal({ country: 'US', phone: '2122323232' })\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\tlet thrower\r\n\r\n\t\t// No input\r\n\t\tparseNumber('').should.deep.equal({})\r\n\r\n\t\t// No country phone code\r\n\t\tparseNumber('+').should.deep.equal({})\r\n\r\n\t\t// No country at all (non international number and no explicit country code)\r\n\t\tparseNumber('123').should.deep.equal({})\r\n\r\n\t\t// No country metadata for this `require` country code\r\n\t\tthrower = () => parseNumber('123', 'ZZ')\r\n\t\tthrower.should.throw('Unknown country')\r\n\r\n\t\t// No country metadata for this `default` country code\r\n\t\tthrower = () => parseNumber('123', { defaultCountry: 'ZZ' })\r\n\t\tthrower.should.throw('Unknown country')\r\n\r\n\t\t// Invalid country phone code\r\n\t\tparseNumber('+210').should.deep.equal({})\r\n\r\n\t\t// Invalid country phone code (extended parsing mode)\r\n\t\tparseNumber('+210', { extended: true }).should.deep.equal({})\r\n\r\n\t\t// Too short of a number.\r\n\t\tparseNumber('1', 'US', { extended: true }).should.deep.equal({})\r\n\r\n\t\t// Too long of a number.\r\n\t\tparseNumber('1111111111111111111', 'RU', { extended: true }).should.deep.equal({})\r\n\r\n\t\t// Not a number.\r\n\t\tparseNumber('abcdefg', 'US', { extended: true }).should.deep.equal({})\r\n\r\n\t\t// Country phone code beginning with a '0'\r\n\t\tparseNumber('+0123').should.deep.equal({})\r\n\r\n\t\t// Barbados NANPA phone number\r\n\t\tparseNumber('+12460000000').should.deep.equal({ country: 'BB', phone: '2460000000' })\r\n\r\n\t\t// // A case when country (restricted to) is not equal\r\n\t\t// // to the one parsed out of an international number.\r\n\t\t// parseNumber('+1-213-373-4253', 'RU').should.deep.equal({})\r\n\r\n\t\t// National (significant) number too short\r\n\t\tparseNumber('2', 'US').should.deep.equal({})\r\n\r\n\t\t// National (significant) number too long\r\n\t\tparseNumber('222222222222222222', 'US').should.deep.equal({})\r\n\r\n\t\t// No `national_prefix_for_parsing`\r\n\t\tparseNumber('41111', 'AC').should.deep.equal({ country: 'AC', phone: '41111'})\r\n\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/235\r\n\t\t// `matchesEntirely()` bug fix.\r\n\t\tparseNumber('+4915784846111‬').should.deep.equal({ country: 'DE', phone: '15784846111' })\r\n\r\n\t\t// No metadata\r\n\t\tthrower = () => _parseNumber('')\r\n\t\tthrower.should.throw('`metadata` argument not passed')\r\n\r\n\t\t// Numerical `value`\r\n\t\tthrower = () => parseNumber(2141111111, 'US')\r\n\t\tthrower.should.throw('A text for parsing must be a string.')\r\n\r\n\t\t// Input string too long.\r\n\t\tparseNumber('8005553535 ', 'RU').should.deep.equal({})\r\n\t})\r\n\r\n\tit('should parse phone number extensions', () => {\r\n\t\t// \"ext\"\r\n\t\tparseNumber('2134567890 ext 123', 'US').should.deep.equal({\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2134567890',\r\n\t\t\text : '123'\r\n\t\t})\r\n\r\n\t\t// \"ext.\"\r\n\t\tparseNumber('+12134567890 ext. 12345', 'US').should.deep.equal({\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2134567890',\r\n\t\t\text : '12345'\r\n\t\t})\r\n\r\n\t\t// \"доб.\"\r\n\t\tparseNumber('+78005553535 доб. 1234', 'RU').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\text : '1234'\r\n\t\t})\r\n\r\n\t\t// \"#\"\r\n\t\tparseNumber('+12134567890#1234').should.deep.equal({\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2134567890',\r\n\t\t\text : '1234'\r\n\t\t})\r\n\r\n\t\t// \"x\"\r\n\t\tparseNumber('+78005553535 x1234').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\text : '1234'\r\n\t\t})\r\n\r\n\t\t// Not a valid extension\r\n\t\tparseNumber('2134567890 ext. abc', 'US').should.deep.equal({\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2134567890'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse RFC 3966 phone numbers', () => {\r\n\t\tparseNumber('tel:+78005553535;ext=123').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\text : '123'\r\n\t\t})\r\n\r\n\t\t// Should parse \"visual separators\".\r\n\t\tparseNumber('tel:+7(800)555-35.35;ext=123').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\text : '123'\r\n\t\t})\r\n\r\n\t\t// Invalid number.\r\n\t\tparseNumber('tel:+7x8005553535;ext=123').should.deep.equal({})\r\n\t})\r\n\r\n\tit('should parse invalid international numbers even if they are invalid', () => {\r\n\t\tparseNumber('+7(8)8005553535', 'RU').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse carrier codes', () => {\r\n\t\tparseNumber('0 15 21 5555-5555', 'BR', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'BR',\r\n\t\t\tcountryCallingCode : '55',\r\n\t\t\tphone : '2155555555',\r\n\t\t\tcarrierCode : '15',\r\n\t\t\text : undefined,\r\n\t\t\tvalid : true,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse IDD prefixes', () => {\r\n\t\tparseNumber('011 61 2 3456 7890', 'US').should.deep.equal({\r\n\t\t\tphone : '234567890',\r\n\t\t\tcountry : 'AU'\r\n\t\t})\r\n\r\n\t\tparseNumber('011 61 2 3456 7890', 'FR').should.deep.equal({})\r\n\r\n\t\tparseNumber('00 61 2 3456 7890', 'US').should.deep.equal({})\r\n\r\n\t\tparseNumber('810 61 2 3456 7890', 'RU').should.deep.equal({\r\n\t\t\tphone : '234567890',\r\n\t\t\tcountry : 'AU'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should work with v2 API', () => {\r\n\t\tparseNumber('+99989160151539')\r\n\t})\r\n\r\n\tit('should work with Argentina numbers', () => {\r\n\t\t// The same mobile number is written differently\r\n\t\t// in different formats in Argentina:\r\n\t\t// `9` gets prepended in international format.\r\n\t\tparseNumber('+54 9 3435 55 1212').should.deep.equal({\r\n\t\t\tcountry: 'AR',\r\n\t\t\tphone: '93435551212'\r\n\t\t})\r\n\t\tparseNumber('0343 15-555-1212', 'AR').should.deep.equal({\r\n\t\t\tcountry: 'AR',\r\n\t\t\tphone: '93435551212'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should work with Mexico numbers', () => {\r\n\t\t// Fixed line.\r\n\t\tparseNumber('+52 449 978 0001').should.deep.equal({\r\n\t\t\tcountry: 'MX',\r\n\t\t\tphone: '4499780001'\r\n\t\t})\r\n\t\t// \"Dialling tokens 01, 02, 044, 045 and 1 are removed as they are\r\n\t\t// no longer valid since August 2019.\"\r\n\t\t//\r\n\t\t// parseNumber('01 (449)978-0001', 'MX').should.deep.equal({\r\n\t\t// \tcountry: 'MX',\r\n\t\t// \tphone: '4499780001'\r\n\t\t// })\r\n\t\tparseNumber('(449)978-0001', 'MX').should.deep.equal({\r\n\t\t\tcountry: 'MX',\r\n\t\t\tphone: '4499780001'\r\n\t\t})\r\n\t\t// \"Dialling tokens 01, 02, 044, 045 and 1 are removed as they are\r\n\t\t// no longer valid since August 2019.\"\r\n\t\t//\r\n\t\t// // Mobile.\r\n\t\t// // `1` is prepended before area code to mobile numbers in international format.\r\n\t\t// parseNumber('+52 1 33 1234-5678', 'MX').should.deep.equal({\r\n\t\t// \tcountry: 'MX',\r\n\t\t// \tphone: '3312345678'\r\n\t\t// })\r\n\t\tparseNumber('+52 33 1234-5678', 'MX').should.deep.equal({\r\n\t\t\tcountry: 'MX',\r\n\t\t\tphone: '3312345678'\r\n\t\t})\r\n\t\t// \"Dialling tokens 01, 02, 044, 045 and 1 are removed as they are\r\n\t\t// no longer valid since August 2019.\"\r\n\t\t//\r\n\t\t// parseNumber('044 (33) 1234-5678', 'MX').should.deep.equal({\r\n\t\t// \tcountry: 'MX',\r\n\t\t// \tphone: '3312345678'\r\n\t\t// })\r\n\t\t// parseNumber('045 33 1234-5678', 'MX').should.deep.equal({\r\n\t\t// \tcountry: 'MX',\r\n\t\t// \tphone: '3312345678'\r\n\t\t// })\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers', () => {\r\n\t\tparseNumber('+870773111632').should.deep.equal(\r\n\t\t\tUSE_NON_GEOGRAPHIC_COUNTRY_CODE ?\r\n\t\t\t{\r\n\t\t\t\tcountry: '001',\r\n\t\t\t\tphone: '773111632'\r\n\t\t\t} :\r\n\t\t\t{}\r\n\t\t)\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (default country code)', () => {\r\n\t\tparseNumber('773111632', { defaultCallingCode: '870' }).should.deep.equal(\r\n\t\t\tUSE_NON_GEOGRAPHIC_COUNTRY_CODE ?\r\n\t\t\t{\r\n\t\t\t\tcountry: '001',\r\n\t\t\t\tphone: '773111632'\r\n\t\t\t} :\r\n\t\t\t{}\r\n\t\t)\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (extended)', () => {\r\n\t\tparseNumber('+870773111632', { extended: true }).should.deep.equal({\r\n\t\t\tcountry: USE_NON_GEOGRAPHIC_COUNTRY_CODE ? '001' : undefined,\r\n\t\t\tcountryCallingCode: '870',\r\n\t\t\tphone: '773111632',\r\n\t\t\tcarrierCode: undefined,\r\n\t\t\text: undefined,\r\n\t\t\tpossible: true,\r\n\t\t\tvalid: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (default country code) (extended)', () => {\r\n\t\tparseNumber('773111632', { defaultCallingCode: '870', extended: true }).should.deep.equal({\r\n\t\t\tcountry: USE_NON_GEOGRAPHIC_COUNTRY_CODE ? '001' : undefined,\r\n\t\t\tcountryCallingCode: '870',\r\n\t\t\tphone: '773111632',\r\n\t\t\tcarrierCode: undefined,\r\n\t\t\text: undefined,\r\n\t\t\tpossible: true,\r\n\t\t\tvalid: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('shouldn\\'t crash when invalid `defaultCallingCode` is passed', () => {\r\n\t\texpect(() => parseNumber('773111632', { defaultCallingCode: '999' }))\r\n\t\t\t.to.throw('Unknown calling code')\r\n\t})\r\n\r\n\tit('shouldn\\'t set `country` when there\\'s no `defaultCountry` and `defaultCallingCode` is not of a \"non-geographic entity\"', () => {\r\n\t\tparseNumber('88005553535', { defaultCallingCode: '7' }).should.deep.equal({\r\n\t\t\tcountry: 'RU',\r\n\t\t\tphone: '8005553535'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should correctly parse numbers starting with the same digit as the national prefix', () => {\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/373\r\n\t\t// `BY`'s `national_prefix` is `8`.\r\n\t\tparseNumber('+37582004910060').should.deep.equal({\r\n\t\t\tcountry: 'BY',\r\n\t\t\tphone: '82004910060'\r\n\t\t});\r\n\t})\r\n\r\n\tit('should autocorrect numbers without a leading +', () => {\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/376\r\n\t\tparseNumber('375447521111', 'BY').should.deep.equal({\r\n\t\t\tcountry: 'BY',\r\n\t\t\tphone: '447521111'\r\n\t\t});\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/316\r\n\t\tparseNumber('33612902554', 'FR').should.deep.equal({\r\n\t\t\tcountry: 'FR',\r\n\t\t\tphone: '612902554'\r\n\t\t});\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/375\r\n\t\tparseNumber('61438331999', 'AU').should.deep.equal({\r\n\t\t\tcountry: 'AU',\r\n\t\t\tphone: '438331999'\r\n\t\t});\r\n\t\t// A case when `49` is a country calling code of a number without a leading `+`.\r\n\t\tparseNumber('4930123456', 'DE').should.deep.equal({\r\n\t\t\tcountry: 'DE',\r\n\t\t\tphone: '30123456'\r\n\t\t});\r\n\t\t// A case when `49` is a valid area code.\r\n\t\tparseNumber('4951234567890', 'DE').should.deep.equal({\r\n\t\t\tcountry: 'DE',\r\n\t\t\tphone: '4951234567890'\r\n\t\t});\r\n\t})\r\n\r\n\tit('should parse extensions (long extensions with explicitl abels)', () => {\r\n\t\t// Test lower and upper limits of extension lengths for each type of label.\r\n\r\n\t\t// Firstly, when in RFC format: PhoneNumberUtil.extLimitAfterExplicitLabel\r\n\t\tparseNumber('33316005 ext 0', 'NZ').ext.should.equal('0')\r\n\t\tparseNumber('33316005 ext 01234567890123456789', 'NZ').ext.should.equal('01234567890123456789')\r\n\t\t// Extension too long.\r\n\t\texpect(parseNumber('33316005 ext 012345678901234567890', 'NZ').ext).to.be.undefined\r\n\r\n\t\t// Explicit extension label.\r\n\t\tparseNumber('03 3316005ext:1', 'NZ').ext.should.equal('1')\r\n\t\tparseNumber('03 3316005 xtn:12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005 extension\\t12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005 xtensio:12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005 xtensión, 12345678901234567890#', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005extension.12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005 доб:12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\r\n\t\t// Extension too long.\r\n\t\texpect(parseNumber('03 3316005 extension 123456789012345678901', 'NZ').ext).to.be.undefined\r\n\t})\r\n\r\n\tit('should parse extensions (long extensions with auto dialling labels)', () => {\r\n\t\tparseNumber('+12679000000,,123456789012345#').ext.should.equal('123456789012345')\r\n\t\tparseNumber('+12679000000;123456789012345#').ext.should.equal('123456789012345')\r\n\t\tparseNumber('+442034000000,,123456789#').ext.should.equal('123456789')\r\n\t\t// Extension too long.\r\n\t\texpect(parseNumber('+12679000000,,1234567890123456#').ext).to.be.undefined\r\n\t})\r\n\r\n\tit('should parse extensions (short extensions with ambiguous characters)', () => {\r\n\t\tparseNumber('03 3316005 x 123456789', 'NZ').ext.should.equal('123456789')\r\n\t\tparseNumber('03 3316005 x. 123456789', 'NZ').ext.should.equal('123456789')\r\n\t\tparseNumber('03 3316005 #123456789#', 'NZ').ext.should.equal('123456789')\r\n\t\tparseNumber('03 3316005 ~ 123456789', 'NZ').ext.should.equal('123456789')\r\n\t\t// Extension too long.\r\n\t\texpect(parseNumber('03 3316005 ~ 1234567890', 'NZ').ext).to.be.undefined\r\n\t})\r\n\r\n\tit('should parse extensions (short extensions when not sure of label)', () => {\r\n\t\tparseNumber('+1123-456-7890 666666#', { v2: true }).ext.should.equal('666666')\r\n\t\tparseNumber('+11234567890-6#', { v2: true }).ext.should.equal('6')\r\n\t\t// Extension too long.\r\n\t\texpect(() => parseNumber('+1123-456-7890 7777777#', { v2: true })).to.throw('NOT_A_NUMBER')\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,SAASA,WAAT,GAAoC;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EACnCA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,iBAAA,CAAaC,KAAb,CAAmB,IAAnB,EAAyBJ,UAAzB,CAAP;AACA;;AAED,IAAMK,+BAA+B,GAAG,KAAxC;AAEAC,QAAQ,CAAC,OAAD,EAAU,YAAM;EACvBC,EAAE,CAAC,wCAAD,EAA2C,YAAM;IAClD;IACAR,WAAW,CAAC,mBAAD,CAAX,CAAiCS,MAAjC,CAAwCC,IAAxC,CAA6CC,KAA7C,CAAmD,EAAnD,EAFkD,CAGlD;;IACAX,WAAW,CAAC,sBAAD,CAAX,CAAoCS,MAApC,CAA2CC,IAA3C,CAAgDC,KAAhD,CAAsD,EAAtD;IAEAX,WAAW,CAAC,mBAAD,EAAsB,IAAtB,CAAX,CAAuCS,MAAvC,CAA8CC,IAA9C,CAAmDC,KAAnD,CAAyD,EAAzD;IACAX,WAAW,CAAC,gBAAD,EAAmB;MAAEY,cAAc,EAAE;IAAlB,CAAnB,CAAX,CAAwDH,MAAxD,CAA+DC,IAA/D,CAAoEC,KAApE,CAA0E,EAA1E;IACAX,WAAW,CAAC,iBAAD,EAAoB,IAApB,CAAX,CAAqCS,MAArC,CAA4CC,IAA5C,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
+ {"version":3,"file":"parse.test.js","names":["parseNumber","parameters","push","metadata","_parseNumber","apply","USE_NON_GEOGRAPHIC_COUNTRY_CODE","describe","it","should","deep","equal","defaultCountry","country","phone","extended","countryCallingCode","carrierCode","undefined","ext","valid","possible","thrower","defaultCallingCode","expect","to","be","v2"],"sources":["../../source/legacy/parse.test.js"],"sourcesContent":["import metadata from '../../metadata.min.json' assert { type: 'json' }\r\nimport _parseNumber from './parse.js'\r\nimport Metadata from '../metadata.js'\r\n\r\nfunction parseNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _parseNumber.apply(this, parameters)\r\n}\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\ndescribe('parse', () => {\r\n\tit('should not parse invalid phone numbers', () => {\r\n\t\t// Too short.\r\n\t\tparseNumber('+7 (800) 55-35-35').should.deep.equal({})\r\n\t\t// Too long.\r\n\t\tparseNumber('+7 (800) 55-35-35-55').should.deep.equal({})\r\n\r\n\t\tparseNumber('+7 (800) 55-35-35', 'US').should.deep.equal({})\r\n\t\tparseNumber('(800) 55 35 35', { defaultCountry: 'RU' }).should.deep.equal({})\r\n\t\tparseNumber('+1 187 215 5230', 'US').should.deep.equal({})\r\n\r\n\t\tparseNumber('911231231', 'BE').should.deep.equal({})\r\n\t})\r\n\r\n\tit('should parse valid phone numbers', () => {\r\n\t\t// Instant loans\r\n\t\t// https://www.youtube.com/watch?v=6e1pMrYH5jI\r\n\t\t//\r\n\t\t// Restrict to RU\r\n\t\tparseNumber('Phone: 8 (800) 555 35 35.', 'RU').should.deep.equal({ country: 'RU', phone: '8005553535' })\r\n\t\t// International format\r\n\t\tparseNumber('Phone: +7 (800) 555-35-35.').should.deep.equal({ country: 'RU', phone: '8005553535' })\r\n\t\t// // Restrict to US, but not a US country phone code supplied\r\n\t\t// parseNumber('+7 (800) 555-35-35', 'US').should.deep.equal({})\r\n\t\t// Restrict to RU\r\n\t\tparseNumber('(800) 555 35 35', 'RU').should.deep.equal({ country: 'RU', phone: '8005553535' })\r\n\t\t// Default to RU\r\n\t\tparseNumber('8 (800) 555 35 35', { defaultCountry: 'RU' }).should.deep.equal({ country: 'RU', phone: '8005553535' })\r\n\r\n\t\t// Gangster partyline\r\n\t\tparseNumber('+1-213-373-4253').should.deep.equal({ country: 'US', phone: '2133734253' })\r\n\r\n\t\t// Switzerland (just in case)\r\n\t\tparseNumber('044 668 18 00', 'CH').should.deep.equal({ country: 'CH', phone: '446681800' })\r\n\r\n\t\t// China, Beijing\r\n\t\tparseNumber('010-852644821', 'CN').should.deep.equal({ country: 'CN', phone: '10852644821' })\r\n\r\n\t\t// France\r\n\t\tparseNumber('+33169454850').should.deep.equal({ country: 'FR', phone: '169454850' })\r\n\r\n\t\t// UK (Jersey)\r\n\t\tparseNumber('+44 7700 300000').should.deep.equal({ country: 'JE', phone: '7700300000' })\r\n\r\n\t\t// KZ\r\n\t\tparseNumber('+7 702 211 1111').should.deep.equal({ country: 'KZ', phone: '7022111111' })\r\n\r\n\t\t// Brazil\r\n\t\tparseNumber('11987654321', 'BR').should.deep.equal({ country: 'BR', phone: '11987654321' })\r\n\r\n\t\t// Long country phone code.\r\n\t\tparseNumber('+212659777777').should.deep.equal({ country: 'MA', phone: '659777777' })\r\n\r\n\t\t// No country could be derived.\r\n\t\t// parseNumber('+212569887076').should.deep.equal({ countryPhoneCode: '212', phone: '569887076' })\r\n\r\n\t\t// GB. Moible numbers starting 07624* are Isle of Man.\r\n\t\tparseNumber('07624369230', 'GB').should.deep.equal({ country: 'IM', phone: '7624369230' })\r\n\t})\r\n\r\n\tit('should parse possible numbers', () => {\r\n\t\t// Invalid phone number for a given country.\r\n\t\tparseNumber('1112223344', 'RU', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tcountryCallingCode : '7',\r\n\t\t\tphone : '1112223344',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\r\n\t\t// International phone number.\r\n\t\t// Several countries with the same country phone code.\r\n\t\tparseNumber('+71112223344').should.deep.equal({})\r\n\t\tparseNumber('+71112223344', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : undefined,\r\n\t\t\tcountryCallingCode : '7',\r\n\t\t\tphone : '1112223344',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\r\n\t\t// International phone number.\r\n\t\t// Single country with the given country phone code.\r\n\t\tparseNumber('+33011222333', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'FR',\r\n\t\t\tcountryCallingCode : '33',\r\n\t\t\tphone : '011222333',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\r\n\t\t// Too short.\r\n\t\t// Won't strip national prefix `8` because otherwise the number would be too short.\r\n\t\tparseNumber('+7 (800) 55-35-35', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : undefined,\r\n\t\t\tcountryCallingCode : '7',\r\n\t\t\tphone : '800553535',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : false\r\n\t\t})\r\n\r\n\t\t// Too long.\r\n\t\tparseNumber('+1 213 37342530', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : undefined,\r\n\t\t\tcountryCallingCode : '1',\r\n\t\t\tphone : '21337342530',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : false,\r\n\t\t\tpossible : false\r\n\t\t})\r\n\r\n\t\t// No national number to be parsed.\r\n\t\tparseNumber('+996', { extended: true }).should.deep.equal({\r\n\t\t\t// countryCallingCode : '996'\r\n\t\t})\r\n\r\n\t\t// Valid number.\r\n\t\tparseNumber('+78005553535', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tcountryCallingCode : '7',\r\n\t\t\tphone : '8005553535',\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\text : undefined,\r\n\t\t\tvalid : true,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/211\r\n\t\tparseNumber('+966', { extended: true }).should.deep.equal({})\r\n\t\tparseNumber('+9664', { extended: true }).should.deep.equal({})\r\n\t\tparseNumber('+96645', { extended: true }).should.deep.equal({\r\n\t\t\tcarrierCode : undefined,\r\n\t\t\tphone : '45',\r\n\t\t\text : undefined,\r\n\t\t\tcountry : 'SA',\r\n\t\t\tcountryCallingCode : '966',\r\n\t\t\tpossible : false,\r\n\t\t\tvalid : false\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse non-European digits', () => {\r\n\t\tparseNumber('+١٢١٢٢٣٢٣٢٣٢').should.deep.equal({ country: 'US', phone: '2122323232' })\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\tlet thrower\r\n\r\n\t\t// No input\r\n\t\tparseNumber('').should.deep.equal({})\r\n\r\n\t\t// No country phone code\r\n\t\tparseNumber('+').should.deep.equal({})\r\n\r\n\t\t// No country at all (non international number and no explicit country code)\r\n\t\tparseNumber('123').should.deep.equal({})\r\n\r\n\t\t// No country metadata for this `require` country code\r\n\t\tthrower = () => parseNumber('123', 'ZZ')\r\n\t\tthrower.should.throw('Unknown country')\r\n\r\n\t\t// No country metadata for this `default` country code\r\n\t\tthrower = () => parseNumber('123', { defaultCountry: 'ZZ' })\r\n\t\tthrower.should.throw('Unknown country')\r\n\r\n\t\t// Invalid country phone code\r\n\t\tparseNumber('+210').should.deep.equal({})\r\n\r\n\t\t// Invalid country phone code (extended parsing mode)\r\n\t\tparseNumber('+210', { extended: true }).should.deep.equal({})\r\n\r\n\t\t// Too short of a number.\r\n\t\tparseNumber('1', 'US', { extended: true }).should.deep.equal({})\r\n\r\n\t\t// Too long of a number.\r\n\t\tparseNumber('1111111111111111111', 'RU', { extended: true }).should.deep.equal({})\r\n\r\n\t\t// Not a number.\r\n\t\tparseNumber('abcdefg', 'US', { extended: true }).should.deep.equal({})\r\n\r\n\t\t// Country phone code beginning with a '0'\r\n\t\tparseNumber('+0123').should.deep.equal({})\r\n\r\n\t\t// Barbados NANPA phone number\r\n\t\tparseNumber('+12460000000').should.deep.equal({ country: 'BB', phone: '2460000000' })\r\n\r\n\t\t// // A case when country (restricted to) is not equal\r\n\t\t// // to the one parsed out of an international number.\r\n\t\t// parseNumber('+1-213-373-4253', 'RU').should.deep.equal({})\r\n\r\n\t\t// National (significant) number too short\r\n\t\tparseNumber('2', 'US').should.deep.equal({})\r\n\r\n\t\t// National (significant) number too long\r\n\t\tparseNumber('222222222222222222', 'US').should.deep.equal({})\r\n\r\n\t\t// No `national_prefix_for_parsing`\r\n\t\tparseNumber('41111', 'AC').should.deep.equal({ country: 'AC', phone: '41111'})\r\n\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/235\r\n\t\t// `matchesEntirely()` bug fix.\r\n\t\tparseNumber('+4915784846111‬').should.deep.equal({ country: 'DE', phone: '15784846111' })\r\n\r\n\t\t// No metadata\r\n\t\tthrower = () => _parseNumber('')\r\n\t\tthrower.should.throw('`metadata` argument not passed')\r\n\r\n\t\t// Numerical `value`\r\n\t\tthrower = () => parseNumber(2141111111, 'US')\r\n\t\tthrower.should.throw('A text for parsing must be a string.')\r\n\r\n\t\t// Input string too long.\r\n\t\tparseNumber('8005553535 ', 'RU').should.deep.equal({})\r\n\t})\r\n\r\n\tit('should parse phone number extensions', () => {\r\n\t\t// \"ext\"\r\n\t\tparseNumber('2134567890 ext 123', 'US').should.deep.equal({\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2134567890',\r\n\t\t\text : '123'\r\n\t\t})\r\n\r\n\t\t// \"ext.\"\r\n\t\tparseNumber('+12134567890 ext. 12345', 'US').should.deep.equal({\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2134567890',\r\n\t\t\text : '12345'\r\n\t\t})\r\n\r\n\t\t// \"доб.\"\r\n\t\tparseNumber('+78005553535 доб. 1234', 'RU').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\text : '1234'\r\n\t\t})\r\n\r\n\t\t// \"#\"\r\n\t\tparseNumber('+12134567890#1234').should.deep.equal({\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2134567890',\r\n\t\t\text : '1234'\r\n\t\t})\r\n\r\n\t\t// \"x\"\r\n\t\tparseNumber('+78005553535 x1234').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\text : '1234'\r\n\t\t})\r\n\r\n\t\t// Not a valid extension\r\n\t\tparseNumber('2134567890 ext. abc', 'US').should.deep.equal({\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2134567890'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse RFC 3966 phone numbers', () => {\r\n\t\tparseNumber('tel:+78005553535;ext=123').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\text : '123'\r\n\t\t})\r\n\r\n\t\t// Should parse \"visual separators\".\r\n\t\tparseNumber('tel:+7(800)555-35.35;ext=123').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\text : '123'\r\n\t\t})\r\n\r\n\t\t// Invalid number.\r\n\t\tparseNumber('tel:+7x8005553535;ext=123').should.deep.equal({})\r\n\t})\r\n\r\n\tit('should parse invalid international numbers even if they are invalid', () => {\r\n\t\tparseNumber('+7(8)8005553535', 'RU').should.deep.equal({\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse carrier codes', () => {\r\n\t\tparseNumber('0 15 21 5555-5555', 'BR', { extended: true }).should.deep.equal({\r\n\t\t\tcountry : 'BR',\r\n\t\t\tcountryCallingCode : '55',\r\n\t\t\tphone : '2155555555',\r\n\t\t\tcarrierCode : '15',\r\n\t\t\text : undefined,\r\n\t\t\tvalid : true,\r\n\t\t\tpossible : true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse IDD prefixes', () => {\r\n\t\tparseNumber('011 61 2 3456 7890', 'US').should.deep.equal({\r\n\t\t\tphone : '234567890',\r\n\t\t\tcountry : 'AU'\r\n\t\t})\r\n\r\n\t\tparseNumber('011 61 2 3456 7890', 'FR').should.deep.equal({})\r\n\r\n\t\tparseNumber('00 61 2 3456 7890', 'US').should.deep.equal({})\r\n\r\n\t\tparseNumber('810 61 2 3456 7890', 'RU').should.deep.equal({\r\n\t\t\tphone : '234567890',\r\n\t\t\tcountry : 'AU'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should work with v2 API', () => {\r\n\t\tparseNumber('+99989160151539')\r\n\t})\r\n\r\n\tit('should work with Argentina numbers', () => {\r\n\t\t// The same mobile number is written differently\r\n\t\t// in different formats in Argentina:\r\n\t\t// `9` gets prepended in international format.\r\n\t\tparseNumber('+54 9 3435 55 1212').should.deep.equal({\r\n\t\t\tcountry: 'AR',\r\n\t\t\tphone: '93435551212'\r\n\t\t})\r\n\t\tparseNumber('0343 15-555-1212', 'AR').should.deep.equal({\r\n\t\t\tcountry: 'AR',\r\n\t\t\tphone: '93435551212'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should work with Mexico numbers', () => {\r\n\t\t// Fixed line.\r\n\t\tparseNumber('+52 449 978 0001').should.deep.equal({\r\n\t\t\tcountry: 'MX',\r\n\t\t\tphone: '4499780001'\r\n\t\t})\r\n\t\t// \"Dialling tokens 01, 02, 044, 045 and 1 are removed as they are\r\n\t\t// no longer valid since August 2019.\"\r\n\t\t//\r\n\t\t// parseNumber('01 (449)978-0001', 'MX').should.deep.equal({\r\n\t\t// \tcountry: 'MX',\r\n\t\t// \tphone: '4499780001'\r\n\t\t// })\r\n\t\tparseNumber('(449)978-0001', 'MX').should.deep.equal({\r\n\t\t\tcountry: 'MX',\r\n\t\t\tphone: '4499780001'\r\n\t\t})\r\n\t\t// \"Dialling tokens 01, 02, 044, 045 and 1 are removed as they are\r\n\t\t// no longer valid since August 2019.\"\r\n\t\t//\r\n\t\t// // Mobile.\r\n\t\t// // `1` is prepended before area code to mobile numbers in international format.\r\n\t\t// parseNumber('+52 1 33 1234-5678', 'MX').should.deep.equal({\r\n\t\t// \tcountry: 'MX',\r\n\t\t// \tphone: '3312345678'\r\n\t\t// })\r\n\t\tparseNumber('+52 33 1234-5678', 'MX').should.deep.equal({\r\n\t\t\tcountry: 'MX',\r\n\t\t\tphone: '3312345678'\r\n\t\t})\r\n\t\t// \"Dialling tokens 01, 02, 044, 045 and 1 are removed as they are\r\n\t\t// no longer valid since August 2019.\"\r\n\t\t//\r\n\t\t// parseNumber('044 (33) 1234-5678', 'MX').should.deep.equal({\r\n\t\t// \tcountry: 'MX',\r\n\t\t// \tphone: '3312345678'\r\n\t\t// })\r\n\t\t// parseNumber('045 33 1234-5678', 'MX').should.deep.equal({\r\n\t\t// \tcountry: 'MX',\r\n\t\t// \tphone: '3312345678'\r\n\t\t// })\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers', () => {\r\n\t\tparseNumber('+870773111632').should.deep.equal(\r\n\t\t\tUSE_NON_GEOGRAPHIC_COUNTRY_CODE ?\r\n\t\t\t{\r\n\t\t\t\tcountry: '001',\r\n\t\t\t\tphone: '773111632'\r\n\t\t\t} :\r\n\t\t\t{}\r\n\t\t)\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (default country code)', () => {\r\n\t\tparseNumber('773111632', { defaultCallingCode: '870' }).should.deep.equal(\r\n\t\t\tUSE_NON_GEOGRAPHIC_COUNTRY_CODE ?\r\n\t\t\t{\r\n\t\t\t\tcountry: '001',\r\n\t\t\t\tphone: '773111632'\r\n\t\t\t} :\r\n\t\t\t{}\r\n\t\t)\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (extended)', () => {\r\n\t\tparseNumber('+870773111632', { extended: true }).should.deep.equal({\r\n\t\t\tcountry: USE_NON_GEOGRAPHIC_COUNTRY_CODE ? '001' : undefined,\r\n\t\t\tcountryCallingCode: '870',\r\n\t\t\tphone: '773111632',\r\n\t\t\tcarrierCode: undefined,\r\n\t\t\text: undefined,\r\n\t\t\tpossible: true,\r\n\t\t\tvalid: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (default country code) (extended)', () => {\r\n\t\tparseNumber('773111632', { defaultCallingCode: '870', extended: true }).should.deep.equal({\r\n\t\t\tcountry: USE_NON_GEOGRAPHIC_COUNTRY_CODE ? '001' : undefined,\r\n\t\t\tcountryCallingCode: '870',\r\n\t\t\tphone: '773111632',\r\n\t\t\tcarrierCode: undefined,\r\n\t\t\text: undefined,\r\n\t\t\tpossible: true,\r\n\t\t\tvalid: true\r\n\t\t})\r\n\t})\r\n\r\n\tit('shouldn\\'t crash when invalid `defaultCallingCode` is passed', () => {\r\n\t\texpect(() => parseNumber('773111632', { defaultCallingCode: '999' }))\r\n\t\t\t.to.throw('Unknown calling code')\r\n\t})\r\n\r\n\tit('shouldn\\'t set `country` when there\\'s no `defaultCountry` and `defaultCallingCode` is not of a \"non-geographic entity\"', () => {\r\n\t\tparseNumber('88005553535', { defaultCallingCode: '7' }).should.deep.equal({\r\n\t\t\tcountry: 'RU',\r\n\t\t\tphone: '8005553535'\r\n\t\t})\r\n\t})\r\n\r\n\tit('should correctly parse numbers starting with the same digit as the national prefix', () => {\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/373\r\n\t\t// `BY`'s `national_prefix` is `8`.\r\n\t\tparseNumber('+37582004910060').should.deep.equal({\r\n\t\t\tcountry: 'BY',\r\n\t\t\tphone: '82004910060'\r\n\t\t});\r\n\t})\r\n\r\n\tit('should autocorrect numbers without a leading +', () => {\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/376\r\n\t\tparseNumber('375447521111', 'BY').should.deep.equal({\r\n\t\t\tcountry: 'BY',\r\n\t\t\tphone: '447521111'\r\n\t\t});\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/316\r\n\t\tparseNumber('33612902554', 'FR').should.deep.equal({\r\n\t\t\tcountry: 'FR',\r\n\t\t\tphone: '612902554'\r\n\t\t});\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/375\r\n\t\tparseNumber('61438331999', 'AU').should.deep.equal({\r\n\t\t\tcountry: 'AU',\r\n\t\t\tphone: '438331999'\r\n\t\t});\r\n\t\t// A case when `49` is a country calling code of a number without a leading `+`.\r\n\t\tparseNumber('4930123456', 'DE').should.deep.equal({\r\n\t\t\tcountry: 'DE',\r\n\t\t\tphone: '30123456'\r\n\t\t});\r\n\t\t// A case when `49` is a valid area code.\r\n\t\tparseNumber('4951234567890', 'DE').should.deep.equal({\r\n\t\t\tcountry: 'DE',\r\n\t\t\tphone: '4951234567890'\r\n\t\t});\r\n\t})\r\n\r\n\tit('should parse extensions (long extensions with explicitl abels)', () => {\r\n\t\t// Test lower and upper limits of extension lengths for each type of label.\r\n\r\n\t\t// Firstly, when in RFC format: PhoneNumberUtil.extLimitAfterExplicitLabel\r\n\t\tparseNumber('33316005 ext 0', 'NZ').ext.should.equal('0')\r\n\t\tparseNumber('33316005 ext 01234567890123456789', 'NZ').ext.should.equal('01234567890123456789')\r\n\t\t// Extension too long.\r\n\t\texpect(parseNumber('33316005 ext 012345678901234567890', 'NZ').ext).to.be.undefined\r\n\r\n\t\t// Explicit extension label.\r\n\t\tparseNumber('03 3316005ext:1', 'NZ').ext.should.equal('1')\r\n\t\tparseNumber('03 3316005 xtn:12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005 extension\\t12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005 xtensio:12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005 xtensión, 12345678901234567890#', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005extension.12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\t\tparseNumber('03 3316005 доб:12345678901234567890', 'NZ').ext.should.equal('12345678901234567890')\r\n\r\n\t\t// Extension too long.\r\n\t\texpect(parseNumber('03 3316005 extension 123456789012345678901', 'NZ').ext).to.be.undefined\r\n\t})\r\n\r\n\tit('should parse extensions (long extensions with auto dialling labels)', () => {\r\n\t\tparseNumber('+12679000000,,123456789012345#').ext.should.equal('123456789012345')\r\n\t\tparseNumber('+12679000000;123456789012345#').ext.should.equal('123456789012345')\r\n\t\tparseNumber('+442034000000,,123456789#').ext.should.equal('123456789')\r\n\t\t// Extension too long.\r\n\t\texpect(parseNumber('+12679000000,,1234567890123456#').ext).to.be.undefined\r\n\t})\r\n\r\n\tit('should parse extensions (short extensions with ambiguous characters)', () => {\r\n\t\tparseNumber('03 3316005 x 123456789', 'NZ').ext.should.equal('123456789')\r\n\t\tparseNumber('03 3316005 x. 123456789', 'NZ').ext.should.equal('123456789')\r\n\t\tparseNumber('03 3316005 #123456789#', 'NZ').ext.should.equal('123456789')\r\n\t\tparseNumber('03 3316005 ~ 123456789', 'NZ').ext.should.equal('123456789')\r\n\t\t// Extension too long.\r\n\t\texpect(parseNumber('03 3316005 ~ 1234567890', 'NZ').ext).to.be.undefined\r\n\t})\r\n\r\n\tit('should parse extensions (short extensions when not sure of label)', () => {\r\n\t\tparseNumber('+1123-456-7890 666666#', { v2: true }).ext.should.equal('666666')\r\n\t\tparseNumber('+11234567890-6#', { v2: true }).ext.should.equal('6')\r\n\t\t// Extension too long.\r\n\t\texpect(() => parseNumber('+1123-456-7890 7777777#', { v2: true })).to.throw('NOT_A_NUMBER')\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,SAASA,WAAT,GAAoC;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EACnCA,UAAU,CAACC,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,CAA4CmB,GAA5C,CAAgDV,MAAhD,CAAuDE,KAAvD,CAA6D,WAA7D,EAJgF,CAKhF;;IACAa,MAAM,CAACxB,WAAW,CAAC,yBAAD,EAA4B,IAA5B,CAAX,CAA6CmB,GAA9C,CAAN,CAAyDM,EAAzD,CAA4DC,EAA5D,CAA+DR,SAA/D;EACA,CAPC,CAAF;EASAV,EAAE,CAAC,mEAAD,EAAsE,YAAM;IAC7ER,WAAW,CAAC,wBAAD,EAA2B;MAAE2B,EAAE,EAAE;IAAN,CAA3B,CAAX,CAAoDR,GAApD,CAAwDV,MAAxD,CAA+DE,KAA/D,CAAqE,QAArE;IACAX,WAAW,CAAC,iBAAD,EAAoB;MAAE2B,EAAE,EAAE;IAAN,CAApB,CAAX,CAA6CR,GAA7C,CAAiDV,MAAjD,CAAwDE,KAAxD,CAA8D,GAA9D,EAF6E,CAG7E;;IACAa,MAAM,CAAC;MAAA,OAAMxB,WAAW,CAAC,yBAAD,EAA4B;QAAE2B,EAAE,EAAE;MAAN,CAA5B,CAAjB;IAAA,CAAD,CAAN,CAAmEF,EAAnE,UAA4E,cAA5E;EACA,CALC,CAAF;AAMA,CAzgBO,CAAR"}
@@ -175,7 +175,7 @@ describe('parse', function () {
175
175
  parseNumber('+7 (800) 55-35-35', {
176
176
  extended: true
177
177
  }).should.deep.equal({
178
- country: 'RU',
178
+ country: undefined,
179
179
  countryCallingCode: '7',
180
180
  phone: '800553535',
181
181
  carrierCode: undefined,