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
package/README.md CHANGED
@@ -1813,7 +1813,7 @@ Also Google sometimes (very rarely) updates their code:
1813
1813
  * [`AsYouTypeFormatter.java`](https://github.com/google/libphonenumber/blob/master/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java) — `AsYouType`
1814
1814
  * [`PhoneNumberMatcher.java`](https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java) — `findPhoneNumbersInText()`
1815
1815
 
1816
- The latest sync-up was on Mar 18th, 2024.
1816
+ The latest sync-up was on Aug 14th, 2024.
1817
1817
 
1818
1818
  ## Contributing
1819
1819
 
@@ -1255,14 +1255,19 @@ describe('AsYouType.getNumberValue()', function () {
1255
1255
  formatter.input('421901222333').should.equal('421 901 222 333');
1256
1256
  formatter.getTemplate().should.equal('xxx xxx xxx xxx');
1257
1257
  });
1258
- it('should choose `defaultCountry` (non-"main" one) when multiple countries match the number', function () {
1258
+ it('should not choose `defaultCountry` over the "main" one when both the `defaultCountry` and the "main" one match the phone number', function () {
1259
+ // This phone number matches both US and CA because they have the same
1260
+ // regular expression for some weird reason.
1259
1261
  // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103
1260
1262
  var formatter = new AsYouType('CA');
1261
1263
  formatter.input('8004001000');
1262
- formatter.getNumber().country.should.equal('CA');
1264
+ formatter.getNumber().country.should.not.equal('CA');
1265
+ formatter.getNumber().country.should.equal('US'); // This phone number is specific to CA.
1266
+
1263
1267
  var formatter2 = new AsYouType('US');
1264
1268
  formatter2.input('4389999999');
1265
- formatter2.getNumber().country.should.equal('CA'); // No country matches the national number digits.
1269
+ formatter2.getNumber().country.should.equal('CA'); // This phone number doesn't belong neither to CA nor to US.
1270
+ // In fact, it doesn't belong to any country from the "NANPA" zone.
1266
1271
 
1267
1272
  var formatter3 = new AsYouType('US');
1268
1273
  formatter3.input('1111111111');