libphonenumber-js 1.11.2 → 1.11.4
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/build/AsYouType.test.js +33 -23
- package/build/AsYouType.test.js.map +1 -1
- package/build/PhoneNumberMatcher.test.js +6 -5
- package/build/PhoneNumberMatcher.test.js.map +1 -1
- package/build/legacy/parse.test.js +28 -20
- package/build/legacy/parse.test.js.map +1 -1
- package/build/parse.test.js +28 -20
- package/build/parse.test.js.map +1 -1
- package/bundle/libphonenumber-js.min.js +1 -1
- package/bundle/libphonenumber-js.min.js.map +1 -1
- package/bundle/libphonenumber-max.js +1 -1
- package/bundle/libphonenumber-max.js.map +1 -1
- package/bundle/libphonenumber-min.js +1 -1
- package/bundle/libphonenumber-min.js.map +1 -1
- package/bundle/libphonenumber-mobile.js +1 -1
- package/bundle/libphonenumber-mobile.js.map +1 -1
- package/es6/AsYouType.test.js +33 -23
- package/es6/AsYouType.test.js.map +1 -1
- package/es6/PhoneNumberMatcher.test.js +6 -5
- package/es6/PhoneNumberMatcher.test.js.map +1 -1
- package/es6/legacy/parse.test.js +28 -20
- package/es6/legacy/parse.test.js.map +1 -1
- package/es6/parse.test.js +28 -20
- package/es6/parse.test.js.map +1 -1
- package/examples.mobile.json +1 -1
- package/examples.mobile.json.js +1 -1
- package/metadata.full.json +1 -1
- package/metadata.full.json.js +1 -1
- package/metadata.max.json +1 -1
- package/metadata.max.json.js +1 -1
- package/metadata.min.json +1 -1
- package/metadata.min.json.js +1 -1
- package/metadata.mobile.json +1 -1
- package/metadata.mobile.json.js +1 -1
- package/package.json +1 -1
- package/source/AsYouType.test.js +36 -20
- package/source/PhoneNumberMatcher.test.js +7 -4
- package/source/legacy/parse.test.js +27 -18
- package/source/parse.test.js +27 -18
package/package.json
CHANGED
package/source/AsYouType.test.js
CHANGED
|
@@ -750,37 +750,53 @@ describe('AsYouType', () => {
|
|
|
750
750
|
|
|
751
751
|
it('should work with Mexico numbers', () => {
|
|
752
752
|
const asYouType = new AsYouType('MX')
|
|
753
|
-
|
|
753
|
+
|
|
754
|
+
// Fixed line. International.
|
|
754
755
|
asYouType.input('+52(449)978-000').should.equal('+52 449 978 000')
|
|
755
756
|
asYouType.input('1').should.equal('+52 449 978 0001')
|
|
756
757
|
asYouType.reset()
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
asYouType.
|
|
758
|
+
|
|
759
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
760
|
+
// no longer valid since August 2019."
|
|
761
|
+
// // Fixed line. National. With national prefix "01".
|
|
762
|
+
// asYouType.input('01449978000').should.equal('01449 978 000')
|
|
763
|
+
// asYouType.getTemplate().should.equal('xxxxx xxx xxx')
|
|
764
|
+
// asYouType.input('1').should.equal('01449 978 0001')
|
|
765
|
+
// asYouType.getTemplate().should.equal('xxxxx xxx xxxx')
|
|
766
|
+
// asYouType.reset()
|
|
767
|
+
|
|
768
|
+
// Fixed line. National. Without national prefix.
|
|
762
769
|
asYouType.input('(449)978-000').should.equal('449 978 000')
|
|
763
770
|
asYouType.getTemplate().should.equal('xxx xxx xxx')
|
|
764
771
|
asYouType.input('1').should.equal('449 978 0001')
|
|
765
772
|
asYouType.getTemplate().should.equal('xxx xxx xxxx')
|
|
766
|
-
// Mobile.
|
|
767
|
-
// `1` is prepended before area code to mobile numbers in international format.
|
|
768
|
-
asYouType.reset()
|
|
769
|
-
asYouType.input('+521331234567').should.equal('+52 133 1234 567')
|
|
770
|
-
asYouType.getTemplate().should.equal('xxx xxx xxxx xxx')
|
|
771
|
-
// Google's `libphonenumber` seems to not able to format this type of number.
|
|
772
|
-
// https://issuetracker.google.com/issues/147938979
|
|
773
|
-
asYouType.input('8').should.equal('+52 133 1234 5678')
|
|
774
|
-
asYouType.getTemplate().should.equal('xxx xxx xxxx xxxx')
|
|
775
773
|
asYouType.reset()
|
|
774
|
+
|
|
775
|
+
// Mobile.
|
|
776
776
|
asYouType.input('+52331234567').should.equal('+52 33 1234 567')
|
|
777
777
|
asYouType.input('8').should.equal('+52 33 1234 5678')
|
|
778
778
|
asYouType.reset()
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
779
|
+
|
|
780
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
781
|
+
// no longer valid since August 2019."
|
|
782
|
+
// // Mobile.
|
|
783
|
+
// // With `1` prepended before area code to mobile numbers in international format.
|
|
784
|
+
// asYouType.input('+521331234567').should.equal('+52 133 1234 567')
|
|
785
|
+
// asYouType.getTemplate().should.equal('xxx xxx xxxx xxx')
|
|
786
|
+
// // Google's `libphonenumber` seems to not able to format this type of number.
|
|
787
|
+
// // https://issuetracker.google.com/issues/147938979
|
|
788
|
+
// asYouType.input('8').should.equal('+52 133 1234 5678')
|
|
789
|
+
// asYouType.getTemplate().should.equal('xxx xxx xxxx xxxx')
|
|
790
|
+
// asYouType.reset()
|
|
791
|
+
//
|
|
792
|
+
// // Mobile. National. With "044" prefix.
|
|
793
|
+
// asYouType.input('044331234567').should.equal('04433 1234 567')
|
|
794
|
+
// asYouType.input('8').should.equal('04433 1234 5678')
|
|
795
|
+
// asYouType.reset()
|
|
796
|
+
//
|
|
797
|
+
// // Mobile. National. With "045" prefix.
|
|
798
|
+
// asYouType.input('045331234567').should.equal('04533 1234 567')
|
|
799
|
+
// asYouType.input('8').should.equal('04533 1234 5678')
|
|
784
800
|
})
|
|
785
801
|
|
|
786
802
|
it('should just prepend national prefix if national_prefix_formatting_rule does not produce a suitable number', () => {
|
|
@@ -47,10 +47,13 @@ describe('PhoneNumberMatcher', () => {
|
|
|
47
47
|
test('+52 (449)978-0001', 'MX', '4499780001')
|
|
48
48
|
test('01 (449)978-0001', 'MX', '4499780001')
|
|
49
49
|
test('(449)978-0001', 'MX', '4499780001')
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
|
|
51
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
52
|
+
// no longer valid since August 2019."
|
|
53
|
+
// // Test parsing mobile numbers of Mexico.
|
|
54
|
+
// test('+52 1 33 1234-5678', 'MX', '3312345678')
|
|
55
|
+
// test('044 (33) 1234-5678', 'MX', '3312345678')
|
|
56
|
+
// test('045 33 1234-5678', 'MX', '3312345678')
|
|
54
57
|
})
|
|
55
58
|
|
|
56
59
|
it('should find phone numbers from Argentina', () => {
|
|
@@ -353,32 +353,41 @@ describe('parse', () => {
|
|
|
353
353
|
country: 'MX',
|
|
354
354
|
phone: '4499780001'
|
|
355
355
|
})
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
356
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
357
|
+
// no longer valid since August 2019."
|
|
358
|
+
//
|
|
359
|
+
// parseNumber('01 (449)978-0001', 'MX').should.deep.equal({
|
|
360
|
+
// country: 'MX',
|
|
361
|
+
// phone: '4499780001'
|
|
362
|
+
// })
|
|
360
363
|
parseNumber('(449)978-0001', 'MX').should.deep.equal({
|
|
361
364
|
country: 'MX',
|
|
362
365
|
phone: '4499780001'
|
|
363
366
|
})
|
|
364
|
-
//
|
|
365
|
-
//
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
368
|
+
// no longer valid since August 2019."
|
|
369
|
+
//
|
|
370
|
+
// // Mobile.
|
|
371
|
+
// // `1` is prepended before area code to mobile numbers in international format.
|
|
372
|
+
// parseNumber('+52 1 33 1234-5678', 'MX').should.deep.equal({
|
|
373
|
+
// country: 'MX',
|
|
374
|
+
// phone: '3312345678'
|
|
375
|
+
// })
|
|
370
376
|
parseNumber('+52 33 1234-5678', 'MX').should.deep.equal({
|
|
371
377
|
country: 'MX',
|
|
372
378
|
phone: '3312345678'
|
|
373
379
|
})
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
381
|
+
// no longer valid since August 2019."
|
|
382
|
+
//
|
|
383
|
+
// parseNumber('044 (33) 1234-5678', 'MX').should.deep.equal({
|
|
384
|
+
// country: 'MX',
|
|
385
|
+
// phone: '3312345678'
|
|
386
|
+
// })
|
|
387
|
+
// parseNumber('045 33 1234-5678', 'MX').should.deep.equal({
|
|
388
|
+
// country: 'MX',
|
|
389
|
+
// phone: '3312345678'
|
|
390
|
+
// })
|
|
382
391
|
})
|
|
383
392
|
|
|
384
393
|
it('should parse non-geographic numbering plan phone numbers', () => {
|
package/source/parse.test.js
CHANGED
|
@@ -368,32 +368,41 @@ describe('parse', () => {
|
|
|
368
368
|
country: 'MX',
|
|
369
369
|
phone: '4499780001'
|
|
370
370
|
})
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
371
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
372
|
+
// no longer valid since August 2019."
|
|
373
|
+
//
|
|
374
|
+
// parseNumber('01 (449)978-0001', 'MX').should.deep.equal({
|
|
375
|
+
// country: 'MX',
|
|
376
|
+
// phone: '4499780001'
|
|
377
|
+
// })
|
|
375
378
|
parseNumber('(449)978-0001', 'MX').should.deep.equal({
|
|
376
379
|
country: 'MX',
|
|
377
380
|
phone: '4499780001'
|
|
378
381
|
})
|
|
379
|
-
//
|
|
380
|
-
//
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
383
|
+
// no longer valid since August 2019."
|
|
384
|
+
//
|
|
385
|
+
// // Mobile.
|
|
386
|
+
// // `1` is prepended before area code to mobile numbers in international format.
|
|
387
|
+
// parseNumber('+52 1 33 1234-5678', 'MX').should.deep.equal({
|
|
388
|
+
// country: 'MX',
|
|
389
|
+
// phone: '3312345678'
|
|
390
|
+
// })
|
|
385
391
|
parseNumber('+52 33 1234-5678', 'MX').should.deep.equal({
|
|
386
392
|
country: 'MX',
|
|
387
393
|
phone: '3312345678'
|
|
388
394
|
})
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
395
|
+
// "Dialling tokens 01, 02, 044, 045 and 1 are removed as they are
|
|
396
|
+
// no longer valid since August 2019."
|
|
397
|
+
//
|
|
398
|
+
// parseNumber('044 (33) 1234-5678', 'MX').should.deep.equal({
|
|
399
|
+
// country: 'MX',
|
|
400
|
+
// phone: '3312345678'
|
|
401
|
+
// })
|
|
402
|
+
// parseNumber('045 33 1234-5678', 'MX').should.deep.equal({
|
|
403
|
+
// country: 'MX',
|
|
404
|
+
// phone: '3312345678'
|
|
405
|
+
// })
|
|
397
406
|
})
|
|
398
407
|
|
|
399
408
|
it('should parse non-geographic numbering plan phone numbers', () => {
|