libphonenumber-js 1.10.33 → 1.10.36

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libphonenumber-js",
3
- "version": "1.10.33",
3
+ "version": "1.10.36",
4
4
  "description": "A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript",
5
5
  "main": "index.cjs",
6
6
  "module": "index.js",
@@ -383,11 +383,14 @@ export default class AsYouType {
383
383
  const callingCode = metadata.numberingPlan.callingCode()
384
384
  const ambiguousCountries = this.metadata.getCountryCodesForCallingCode(callingCode)
385
385
  if (ambiguousCountries.length > 1) {
386
- country = getCountryByNationalNumber(nationalSignificantNumber, {
386
+ const exactCountry = getCountryByNationalNumber(nationalSignificantNumber, {
387
387
  countries: ambiguousCountries,
388
388
  defaultCountry: this.defaultCountry,
389
389
  metadata: this.metadata.metadata
390
390
  })
391
+ if (exactCountry) {
392
+ country = exactCountry
393
+ }
391
394
  }
392
395
  }
393
396
  }
@@ -1373,6 +1373,11 @@ describe('AsYouType.getNumberValue()', () => {
1373
1373
  const formatter2 = new AsYouType('US')
1374
1374
  formatter2.input('4389999999')
1375
1375
  formatter2.getNumber().country.should.equal('CA')
1376
+
1377
+ // No country matches the national number digits.
1378
+ const formatter3 = new AsYouType('US')
1379
+ formatter3.input('1111111111')
1380
+ formatter3.getNumber().country.should.equal('US')
1376
1381
  })
1377
1382
  })
1378
1383