libphonenumber-js 1.11.4 → 1.11.17

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 (37) hide show
  1. package/README.md +1 -1
  2. package/build/AsYouType.test.js +8 -3
  3. package/build/AsYouType.test.js.map +1 -1
  4. package/build/helpers/getCountryByNationalNumber.js +17 -17
  5. package/build/helpers/getCountryByNationalNumber.js.map +1 -1
  6. package/build/parse.test.js +7 -3
  7. package/build/parse.test.js.map +1 -1
  8. package/bundle/libphonenumber-js.min.js +1 -1
  9. package/bundle/libphonenumber-js.min.js.map +1 -1
  10. package/bundle/libphonenumber-max.js +1 -1
  11. package/bundle/libphonenumber-max.js.map +1 -1
  12. package/bundle/libphonenumber-min.js +1 -1
  13. package/bundle/libphonenumber-min.js.map +1 -1
  14. package/bundle/libphonenumber-mobile.js +1 -1
  15. package/bundle/libphonenumber-mobile.js.map +1 -1
  16. package/es6/AsYouType.test.js +8 -3
  17. package/es6/AsYouType.test.js.map +1 -1
  18. package/es6/helpers/getCountryByNationalNumber.js +17 -17
  19. package/es6/helpers/getCountryByNationalNumber.js.map +1 -1
  20. package/es6/parse.test.js +7 -3
  21. package/es6/parse.test.js.map +1 -1
  22. package/examples.mobile.json +1 -1
  23. package/examples.mobile.json.js +1 -1
  24. package/index.d.cts +54 -19
  25. package/index.d.ts +54 -19
  26. package/metadata.full.json +1 -1
  27. package/metadata.full.json.js +1 -1
  28. package/metadata.max.json +1 -1
  29. package/metadata.max.json.js +1 -1
  30. package/metadata.min.json +1 -1
  31. package/metadata.min.json.js +1 -1
  32. package/metadata.mobile.json +1 -1
  33. package/metadata.mobile.json.js +1 -1
  34. package/package.json +2 -2
  35. package/source/AsYouType.test.js +8 -3
  36. package/source/helpers/getCountryByNationalNumber.js +18 -14
  37. package/source/parse.test.js +7 -3
@@ -1250,14 +1250,19 @@ describe('AsYouType.getNumberValue()', function () {
1250
1250
  formatter.input('421901222333').should.equal('421 901 222 333');
1251
1251
  formatter.getTemplate().should.equal('xxx xxx xxx xxx');
1252
1252
  });
1253
- it('should choose `defaultCountry` (non-"main" one) when multiple countries match the number', function () {
1253
+ it('should not choose `defaultCountry` over the "main" one when both the `defaultCountry` and the "main" one match the phone number', function () {
1254
+ // This phone number matches both US and CA because they have the same
1255
+ // regular expression for some weird reason.
1254
1256
  // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103
1255
1257
  var formatter = new AsYouType('CA');
1256
1258
  formatter.input('8004001000');
1257
- formatter.getNumber().country.should.equal('CA');
1259
+ formatter.getNumber().country.should.not.equal('CA');
1260
+ formatter.getNumber().country.should.equal('US'); // This phone number is specific to CA.
1261
+
1258
1262
  var formatter2 = new AsYouType('US');
1259
1263
  formatter2.input('4389999999');
1260
- formatter2.getNumber().country.should.equal('CA'); // No country matches the national number digits.
1264
+ formatter2.getNumber().country.should.equal('CA'); // This phone number doesn't belong neither to CA nor to US.
1265
+ // In fact, it doesn't belong to any country from the "NANPA" zone.
1261
1266
 
1262
1267
  var formatter3 = new AsYouType('US');
1263
1268
  formatter3.input('1111111111');