libphonenumber-js 1.10.12 → 1.10.14
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/.babelrc +2 -1
- package/build/AsYouType.test.js.map +1 -1
- package/build/PhoneNumber.test.js.map +1 -1
- package/build/PhoneNumberMatcher.test.js.map +1 -1
- package/build/findNumbers.test.js.map +1 -1
- package/build/findPhoneNumbers.test.js.map +1 -1
- package/build/findPhoneNumbersInText.test.js.map +1 -1
- package/build/format.test.js.map +1 -1
- package/build/formatIncompletePhoneNumber.test.js.map +1 -1
- package/build/formatNumberForMobileDialing.test.js +1 -1
- package/build/formatNumberForMobileDialing.test.js.map +1 -1
- package/build/getCountries.test.js.map +1 -1
- package/build/getCountryCallingCode.test.js.map +1 -1
- package/build/getExampleNumber.test.js.map +1 -1
- package/build/getNumberType.test.js.map +1 -1
- package/build/helpers/checkNumberLength.test.js.map +1 -1
- package/build/helpers/extractCountryCallingCode.test.js.map +1 -1
- package/build/helpers/extractNationalNumber.test.js.map +1 -1
- package/build/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js.map +1 -1
- package/build/helpers/getNumberType.test.js.map +1 -1
- package/build/helpers/stripIddPrefix.test.js.map +1 -1
- package/build/isPossibleNumber.test.js.map +1 -1
- package/build/isPossiblePhoneNumber.test.js.map +1 -1
- package/build/isValidNumberForRegion.test.js.map +1 -1
- package/build/isValidPhoneNumber.test.js.map +1 -1
- package/build/metadata.test.js.map +1 -1
- package/build/parse.test.js.map +1 -1
- package/build/parsePhoneNumber.test.js.map +1 -1
- package/build/parsePhoneNumberFromString.test.js.map +1 -1
- package/build/searchNumbers.test.js.map +1 -1
- package/build/searchPhoneNumbersInText.test.js.map +1 -1
- package/build/validate.test.js.map +1 -1
- package/build/validatePhoneNumberLength.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 +1 -1
- package/es6/AsYouType.test.js.map +1 -1
- package/es6/PhoneNumber.test.js +1 -1
- package/es6/PhoneNumber.test.js.map +1 -1
- package/es6/PhoneNumberMatcher.test.js +1 -1
- package/es6/PhoneNumberMatcher.test.js.map +1 -1
- package/es6/findNumbers.test.js +1 -1
- package/es6/findNumbers.test.js.map +1 -1
- package/es6/findPhoneNumbers.test.js +1 -1
- package/es6/findPhoneNumbers.test.js.map +1 -1
- package/es6/findPhoneNumbersInText.test.js +1 -1
- package/es6/findPhoneNumbersInText.test.js.map +1 -1
- package/es6/format.test.js +1 -1
- package/es6/format.test.js.map +1 -1
- package/es6/formatIncompletePhoneNumber.test.js +1 -1
- package/es6/formatIncompletePhoneNumber.test.js.map +1 -1
- package/es6/formatNumberForMobileDialing.test.js +1 -1
- package/es6/formatNumberForMobileDialing.test.js.map +1 -1
- package/es6/getCountries.test.js +1 -1
- package/es6/getCountries.test.js.map +1 -1
- package/es6/getCountryCallingCode.test.js +1 -1
- package/es6/getCountryCallingCode.test.js.map +1 -1
- package/es6/getExampleNumber.test.js +2 -2
- package/es6/getExampleNumber.test.js.map +1 -1
- package/es6/getNumberType.test.js +1 -1
- package/es6/getNumberType.test.js.map +1 -1
- package/es6/helpers/checkNumberLength.test.js +2 -2
- package/es6/helpers/checkNumberLength.test.js.map +1 -1
- package/es6/helpers/extractCountryCallingCode.test.js +1 -1
- package/es6/helpers/extractCountryCallingCode.test.js.map +1 -1
- package/es6/helpers/extractNationalNumber.test.js +1 -1
- package/es6/helpers/extractNationalNumber.test.js.map +1 -1
- package/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js +1 -1
- package/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js.map +1 -1
- package/es6/helpers/getNumberType.test.js +1 -1
- package/es6/helpers/getNumberType.test.js.map +1 -1
- package/es6/helpers/stripIddPrefix.test.js +1 -1
- package/es6/helpers/stripIddPrefix.test.js.map +1 -1
- package/es6/isPossibleNumber.test.js +1 -1
- package/es6/isPossibleNumber.test.js.map +1 -1
- package/es6/isPossiblePhoneNumber.test.js +2 -2
- package/es6/isPossiblePhoneNumber.test.js.map +1 -1
- package/es6/isValidNumberForRegion.test.js +1 -1
- package/es6/isValidNumberForRegion.test.js.map +1 -1
- package/es6/isValidPhoneNumber.test.js +1 -1
- package/es6/isValidPhoneNumber.test.js.map +1 -1
- package/es6/metadata.test.js +5 -5
- package/es6/metadata.test.js.map +1 -1
- package/es6/parse.test.js +1 -1
- package/es6/parse.test.js.map +1 -1
- package/es6/parsePhoneNumber.test.js +2 -2
- package/es6/parsePhoneNumber.test.js.map +1 -1
- package/es6/parsePhoneNumberFromString.test.js +1 -1
- package/es6/parsePhoneNumberFromString.test.js.map +1 -1
- package/es6/searchNumbers.test.js +1 -1
- package/es6/searchNumbers.test.js.map +1 -1
- package/es6/searchPhoneNumbersInText.test.js +1 -1
- package/es6/searchPhoneNumbersInText.test.js.map +1 -1
- package/es6/validate.test.js +1 -1
- package/es6/validate.test.js.map +1 -1
- package/es6/validatePhoneNumberLength.test.js +1 -1
- package/es6/validatePhoneNumberLength.test.js.map +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 +2 -2
- package/runnable/generate-country-codes.js +1 -1
- package/source/AsYouType.test.js +1 -1
- package/source/PhoneNumber.test.js +1 -1
- package/source/PhoneNumberMatcher.test.js +1 -1
- package/source/findNumbers.test.js +1 -1
- package/source/findPhoneNumbers.test.js +1 -1
- package/source/findPhoneNumbersInText.test.js +1 -1
- package/source/format.test.js +1 -1
- package/source/formatIncompletePhoneNumber.test.js +1 -1
- package/source/formatNumberForMobileDialing.test.js +1 -1
- package/source/getCountries.test.js +1 -1
- package/source/getCountryCallingCode.test.js +1 -1
- package/source/getExampleNumber.test.js +2 -2
- package/source/getNumberType.test.js +1 -1
- package/source/helpers/checkNumberLength.test.js +2 -2
- package/source/helpers/extractCountryCallingCode.test.js +1 -1
- package/source/helpers/extractNationalNumber.test.js +1 -1
- package/source/helpers/extractNationalNumberFromPossiblyIncompleteNumber.test.js +1 -1
- package/source/helpers/getNumberType.test.js +1 -1
- package/source/helpers/stripIddPrefix.test.js +1 -1
- package/source/isPossibleNumber.test.js +1 -1
- package/source/isPossiblePhoneNumber.test.js +2 -2
- package/source/isValidNumberForRegion.test.js +1 -1
- package/source/isValidPhoneNumber.test.js +1 -1
- package/source/metadata.test.js +5 -5
- package/source/parse.test.js +1 -1
- package/source/parsePhoneNumber.test.js +2 -2
- package/source/parsePhoneNumberFromString.test.js +1 -1
- package/source/searchNumbers.test.js +1 -1
- package/source/searchPhoneNumbersInText.test.js +1 -1
- package/source/validate.test.js +1 -1
- package/source/validatePhoneNumberLength.test.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValidNumberForRegion.test.js","names":["isValidNumberForRegion","parameters","push","metadata","isValidNumberForRegionCustom","apply","describe","it","should","equal","expect","phone","country","to","_isValidNumberForRegion"],"sources":["../source/isValidNumberForRegion.test.js"],"sourcesContent":["import metadata from '../metadata.min.json'\r\nimport isValidNumberForRegionCustom from './isValidNumberForRegion.js'\r\nimport _isValidNumberForRegion from './isValidNumberForRegion_.js'\r\n\r\nfunction isValidNumberForRegion(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn isValidNumberForRegionCustom.apply(this, parameters)\r\n}\r\n\r\ndescribe('isValidNumberForRegion', () => {\r\n\tit('should detect if is valid number for region', () => {\r\n\t\tisValidNumberForRegion('07624369230', 'GB').should.equal(false)\r\n\t\tisValidNumberForRegion('07624369230', 'IM').should.equal(true)\r\n\t})\r\n\r\n\tit('should validate arguments', () => {\r\n\t\texpect(() => isValidNumberForRegion({ phone: '7624369230', country: 'GB' })).to.throw('number must be a string')\r\n\t\texpect(() => isValidNumberForRegion('7624369230')).to.throw('country must be a string')\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\t// Not a \"viable\" phone number.\r\n\t\tisValidNumberForRegion('7', 'GB').should.equal(false)\r\n\r\n\t\t// `options` argument `if/else` coverage.\r\n\t\t_isValidNumberForRegion('07624369230', 'GB', {}, metadata).should.equal(false)\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,SAASA,sBAAT,GAA+C;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EAC9CA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,mCAAA,CAA6BC,KAA7B,CAAmC,IAAnC,EAAyCJ,UAAzC,CAAP;AACA;;AAEDK,QAAQ,CAAC,wBAAD,EAA2B,YAAM;EACxCC,EAAE,CAAC,6CAAD,EAAgD,YAAM;IACvDP,sBAAsB,CAAC,aAAD,EAAgB,IAAhB,CAAtB,CAA4CQ,MAA5C,CAAmDC,KAAnD,CAAyD,KAAzD;IACAT,sBAAsB,CAAC,aAAD,EAAgB,IAAhB,CAAtB,CAA4CQ,MAA5C,CAAmDC,KAAnD,CAAyD,IAAzD;EACA,CAHC,CAAF;EAKAF,EAAE,CAAC,2BAAD,EAA8B,YAAM;IACrCG,MAAM,CAAC;MAAA,OAAMV,sBAAsB,CAAC;QAAEW,KAAK,EAAE,YAAT;QAAuBC,OAAO,EAAE;MAAhC,CAAD,CAA5B;IAAA,CAAD,CAAN,CAA6EC,EAA7E,UAAsF,yBAAtF;IACAH,MAAM,CAAC;MAAA,OAAMV,sBAAsB,CAAC,YAAD,CAA5B;IAAA,CAAD,CAAN,CAAmDa,EAAnD,UAA4D,0BAA5D;EACA,CAHC,CAAF;EAKAN,EAAE,CAAC,2BAAD,EAA8B,YAAM;IACrC;IACAP,sBAAsB,CAAC,GAAD,EAAM,IAAN,CAAtB,CAAkCQ,MAAlC,CAAyCC,KAAzC,CAA+C,KAA/C,EAFqC,CAIrC;;IACA,IAAAK,mCAAA,EAAwB,aAAxB,EAAuC,IAAvC,EAA6C,EAA7C,EAAiDX,uBAAjD,EAA2DK,MAA3D,CAAkEC,KAAlE,CAAwE,KAAxE;EACA,CANC,CAAF;AAOA,CAlBO,CAAR"}
|
|
1
|
+
{"version":3,"file":"isValidNumberForRegion.test.js","names":["isValidNumberForRegion","parameters","push","metadata","isValidNumberForRegionCustom","apply","describe","it","should","equal","expect","phone","country","to","_isValidNumberForRegion"],"sources":["../source/isValidNumberForRegion.test.js"],"sourcesContent":["import metadata from '../metadata.min.json' assert { type: 'json' }\r\nimport isValidNumberForRegionCustom from './isValidNumberForRegion.js'\r\nimport _isValidNumberForRegion from './isValidNumberForRegion_.js'\r\n\r\nfunction isValidNumberForRegion(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn isValidNumberForRegionCustom.apply(this, parameters)\r\n}\r\n\r\ndescribe('isValidNumberForRegion', () => {\r\n\tit('should detect if is valid number for region', () => {\r\n\t\tisValidNumberForRegion('07624369230', 'GB').should.equal(false)\r\n\t\tisValidNumberForRegion('07624369230', 'IM').should.equal(true)\r\n\t})\r\n\r\n\tit('should validate arguments', () => {\r\n\t\texpect(() => isValidNumberForRegion({ phone: '7624369230', country: 'GB' })).to.throw('number must be a string')\r\n\t\texpect(() => isValidNumberForRegion('7624369230')).to.throw('country must be a string')\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\t// Not a \"viable\" phone number.\r\n\t\tisValidNumberForRegion('7', 'GB').should.equal(false)\r\n\r\n\t\t// `options` argument `if/else` coverage.\r\n\t\t_isValidNumberForRegion('07624369230', 'GB', {}, metadata).should.equal(false)\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,SAASA,sBAAT,GAA+C;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EAC9CA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,mCAAA,CAA6BC,KAA7B,CAAmC,IAAnC,EAAyCJ,UAAzC,CAAP;AACA;;AAEDK,QAAQ,CAAC,wBAAD,EAA2B,YAAM;EACxCC,EAAE,CAAC,6CAAD,EAAgD,YAAM;IACvDP,sBAAsB,CAAC,aAAD,EAAgB,IAAhB,CAAtB,CAA4CQ,MAA5C,CAAmDC,KAAnD,CAAyD,KAAzD;IACAT,sBAAsB,CAAC,aAAD,EAAgB,IAAhB,CAAtB,CAA4CQ,MAA5C,CAAmDC,KAAnD,CAAyD,IAAzD;EACA,CAHC,CAAF;EAKAF,EAAE,CAAC,2BAAD,EAA8B,YAAM;IACrCG,MAAM,CAAC;MAAA,OAAMV,sBAAsB,CAAC;QAAEW,KAAK,EAAE,YAAT;QAAuBC,OAAO,EAAE;MAAhC,CAAD,CAA5B;IAAA,CAAD,CAAN,CAA6EC,EAA7E,UAAsF,yBAAtF;IACAH,MAAM,CAAC;MAAA,OAAMV,sBAAsB,CAAC,YAAD,CAA5B;IAAA,CAAD,CAAN,CAAmDa,EAAnD,UAA4D,0BAA5D;EACA,CAHC,CAAF;EAKAN,EAAE,CAAC,2BAAD,EAA8B,YAAM;IACrC;IACAP,sBAAsB,CAAC,GAAD,EAAM,IAAN,CAAtB,CAAkCQ,MAAlC,CAAyCC,KAAzC,CAA+C,KAA/C,EAFqC,CAIrC;;IACA,IAAAK,mCAAA,EAAwB,aAAxB,EAAuC,IAAvC,EAA6C,EAA7C,EAAiDX,uBAAjD,EAA2DK,MAA3D,CAAkEC,KAAlE,CAAwE,KAAxE;EACA,CANC,CAAF;AAOA,CAlBO,CAAR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValidPhoneNumber.test.js","names":["isValidPhoneNumber","parameters","push","metadata","_isValidPhoneNumber","apply","describe","it","should","equal","defaultCountry"],"sources":["../source/isValidPhoneNumber.test.js"],"sourcesContent":["import _isValidPhoneNumber from './isValidPhoneNumber.js'\r\nimport metadata from '../metadata.min.json'\r\n\r\nfunction isValidPhoneNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _isValidPhoneNumber.apply(this, parameters)\r\n}\r\n\r\ndescribe('isValidPhoneNumber', () => {\r\n\tit('should detect whether a phone number is valid', () => {\r\n\t\tisValidPhoneNumber('8 (800) 555 35 35', 'RU').should.equal(true)\r\n\t\tisValidPhoneNumber('8 (800) 555 35 35 0', 'RU').should.equal(false)\r\n\t\tisValidPhoneNumber('Call: 8 (800) 555 35 35', 'RU').should.equal(false)\r\n\t\tisValidPhoneNumber('8 (800) 555 35 35', { defaultCountry: 'RU' }).should.equal(true)\r\n\t\tisValidPhoneNumber('+7 (800) 555 35 35').should.equal(true)\r\n\t\tisValidPhoneNumber('+7 1 (800) 555 35 35').should.equal(false)\r\n\t\tisValidPhoneNumber(' +7 (800) 555 35 35').should.equal(false)\r\n\t\tisValidPhoneNumber(' ').should.equal(false)\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEA,SAASA,kBAAT,GAA2C;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EAC1CA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,+BAAA,CAAoBC,KAApB,CAA0B,IAA1B,EAAgCJ,UAAhC,CAAP;AACA;;AAEDK,QAAQ,CAAC,oBAAD,EAAuB,YAAM;EACpCC,EAAE,CAAC,+CAAD,EAAkD,YAAM;IACzDP,kBAAkB,CAAC,mBAAD,EAAsB,IAAtB,CAAlB,CAA8CQ,MAA9C,CAAqDC,KAArD,CAA2D,IAA3D;IACAT,kBAAkB,CAAC,qBAAD,EAAwB,IAAxB,CAAlB,CAAgDQ,MAAhD,CAAuDC,KAAvD,CAA6D,KAA7D;IACAT,kBAAkB,CAAC,yBAAD,EAA4B,IAA5B,CAAlB,CAAoDQ,MAApD,CAA2DC,KAA3D,CAAiE,KAAjE;IACAT,kBAAkB,CAAC,mBAAD,EAAsB;MAAEU,cAAc,EAAE;IAAlB,CAAtB,CAAlB,CAAkEF,MAAlE,CAAyEC,KAAzE,CAA+E,IAA/E;IACAT,kBAAkB,CAAC,oBAAD,CAAlB,CAAyCQ,MAAzC,CAAgDC,KAAhD,CAAsD,IAAtD;IACAT,kBAAkB,CAAC,sBAAD,CAAlB,CAA2CQ,MAA3C,CAAkDC,KAAlD,CAAwD,KAAxD;IACAT,kBAAkB,CAAC,qBAAD,CAAlB,CAA0CQ,MAA1C,CAAiDC,KAAjD,CAAuD,KAAvD;IACAT,kBAAkB,CAAC,GAAD,CAAlB,CAAwBQ,MAAxB,CAA+BC,KAA/B,CAAqC,KAArC;EACA,CATC,CAAF;AAUA,CAXO,CAAR"}
|
|
1
|
+
{"version":3,"file":"isValidPhoneNumber.test.js","names":["isValidPhoneNumber","parameters","push","metadata","_isValidPhoneNumber","apply","describe","it","should","equal","defaultCountry"],"sources":["../source/isValidPhoneNumber.test.js"],"sourcesContent":["import _isValidPhoneNumber from './isValidPhoneNumber.js'\r\nimport metadata from '../metadata.min.json' assert { type: 'json' }\r\n\r\nfunction isValidPhoneNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _isValidPhoneNumber.apply(this, parameters)\r\n}\r\n\r\ndescribe('isValidPhoneNumber', () => {\r\n\tit('should detect whether a phone number is valid', () => {\r\n\t\tisValidPhoneNumber('8 (800) 555 35 35', 'RU').should.equal(true)\r\n\t\tisValidPhoneNumber('8 (800) 555 35 35 0', 'RU').should.equal(false)\r\n\t\tisValidPhoneNumber('Call: 8 (800) 555 35 35', 'RU').should.equal(false)\r\n\t\tisValidPhoneNumber('8 (800) 555 35 35', { defaultCountry: 'RU' }).should.equal(true)\r\n\t\tisValidPhoneNumber('+7 (800) 555 35 35').should.equal(true)\r\n\t\tisValidPhoneNumber('+7 1 (800) 555 35 35').should.equal(false)\r\n\t\tisValidPhoneNumber(' +7 (800) 555 35 35').should.equal(false)\r\n\t\tisValidPhoneNumber(' ').should.equal(false)\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEA,SAASA,kBAAT,GAA2C;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EAC1CA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,+BAAA,CAAoBC,KAApB,CAA0B,IAA1B,EAAgCJ,UAAhC,CAAP;AACA;;AAEDK,QAAQ,CAAC,oBAAD,EAAuB,YAAM;EACpCC,EAAE,CAAC,+CAAD,EAAkD,YAAM;IACzDP,kBAAkB,CAAC,mBAAD,EAAsB,IAAtB,CAAlB,CAA8CQ,MAA9C,CAAqDC,KAArD,CAA2D,IAA3D;IACAT,kBAAkB,CAAC,qBAAD,EAAwB,IAAxB,CAAlB,CAAgDQ,MAAhD,CAAuDC,KAAvD,CAA6D,KAA7D;IACAT,kBAAkB,CAAC,yBAAD,EAA4B,IAA5B,CAAlB,CAAoDQ,MAApD,CAA2DC,KAA3D,CAAiE,KAAjE;IACAT,kBAAkB,CAAC,mBAAD,EAAsB;MAAEU,cAAc,EAAE;IAAlB,CAAtB,CAAlB,CAAkEF,MAAlE,CAAyEC,KAAzE,CAA+E,IAA/E;IACAT,kBAAkB,CAAC,oBAAD,CAAlB,CAAyCQ,MAAzC,CAAgDC,KAAhD,CAAsD,IAAtD;IACAT,kBAAkB,CAAC,sBAAD,CAAlB,CAA2CQ,MAA3C,CAAkDC,KAAlD,CAAwD,KAAxD;IACAT,kBAAkB,CAAC,qBAAD,CAAlB,CAA0CQ,MAA1C,CAAiDC,KAAjD,CAAuD,KAAvD;IACAT,kBAAkB,CAAC,GAAD,CAAlB,CAAwBQ,MAAxB,CAA+BC,KAA/B,CAAqC,KAArC;EACA,CATC,CAAF;AAUA,CAXO,CAAR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.test.js","names":["describe","it","FR","Metadata","metadata","country","type","should","equal","thrower","isSupportedCountry","getExtPrefix","getNumberingPlanMetadata","nationalPrefixForParsing","chooseCountryByCountryCallingCode","meta","numberingPlan","formats","nationalPrefixIsMandatoryWhenFormattingInNationalFormat","validateMetadata","a","b","countries","country_calling_codes","metadataV4","selectNumberingPlan","nonGeographic","metadataV3","metadataV2","possibleLengths","deep","length","nationalPrefix","pattern","leadingDigits","expect","nationalPrefixTransformRule","to","be","nationalPrefixFormattingRule","nationalPrefixIsOptionalWhenFormattingInNationalFormat","metadataV1","ext","metaNew","defaultIDDPrefix","something"],"sources":["../source/metadata.test.js"],"sourcesContent":["import metadata from '../metadata.min.json'\r\nimport metadataV1 from '../test/metadata/1.0.0/metadata.min.json'\r\nimport metadataV2 from '../test/metadata/1.1.11/metadata.min.json'\r\nimport metadataV3 from '../test/metadata/1.7.34/metadata.min.json'\r\nimport metadataV4 from '../test/metadata/1.7.37/metadata.min.json'\r\n\r\nimport Metadata, { validateMetadata, getExtPrefix, isSupportedCountry } from './metadata.js'\r\n\r\ndescribe('metadata', () => {\r\n\tit('should return undefined for non-defined types', () => {\r\n\t\tconst FR = new Metadata(metadata).country('FR')\r\n\t\ttype(FR.type('FIXED_LINE')).should.equal('undefined')\r\n\t})\r\n\r\n\tit('should validate country', () => {\r\n\t\tconst thrower = () => new Metadata(metadata).country('RUS')\r\n\t\tthrower.should.throw('Unknown country')\r\n\t})\r\n\r\n\tit('should tell if a country is supported', () => {\r\n\t\tisSupportedCountry('RU', metadata).should.equal(true)\r\n\t\tisSupportedCountry('XX', metadata).should.equal(false)\r\n\t})\r\n\r\n\tit('should return ext prefix for a country', () => {\r\n\t\tgetExtPrefix('US', metadata).should.equal(' ext. ')\r\n\t\tgetExtPrefix('CA', metadata).should.equal(' ext. ')\r\n\t\tgetExtPrefix('GB', metadata).should.equal(' x')\r\n\t\t// expect(getExtPrefix('XX', metadata)).to.equal(undefined)\r\n\t\tgetExtPrefix('XX', metadata).should.equal(' ext. ')\r\n\t})\r\n\r\n\tit('should cover non-occuring edge cases', () => {\r\n\t\tnew Metadata(metadata).getNumberingPlanMetadata('999')\r\n\t})\r\n\r\n\tit('should support deprecated methods', () => {\r\n\t\tnew Metadata(metadata).country('US').nationalPrefixForParsing().should.equal('1')\r\n\t\tnew Metadata(metadata).chooseCountryByCountryCallingCode('1').nationalPrefixForParsing().should.equal('1')\r\n\t})\r\n\r\n\tit('should tell if a national prefix is mandatory when formatting a national number', () => {\r\n\t\tconst meta = new Metadata(metadata)\r\n\t\t// No \"national_prefix_formatting_rule\".\r\n\t\t// \"national_prefix_is_optional_when_formatting\": true\r\n\t\tmeta.country('US')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsMandatoryWhenFormattingInNationalFormat().should.equal(false)\r\n\t\t// \"national_prefix_formatting_rule\": \"8 ($1)\"\r\n\t\t// \"national_prefix_is_optional_when_formatting\": true\r\n\t\tmeta.country('RU')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsMandatoryWhenFormattingInNationalFormat().should.equal(false)\r\n\t\t// \"national_prefix\": \"0\"\r\n\t\t// \"national_prefix_formatting_rule\": \"0 $1\"\r\n\t\tmeta.country('FR')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsMandatoryWhenFormattingInNationalFormat().should.equal(true)\r\n\t})\r\n\r\n\tit('should validate metadata', () => {\r\n\t\tlet thrower = () => validateMetadata()\r\n\t\tthrower.should.throw('`metadata` argument not passed')\r\n\r\n\t\tthrower = () => validateMetadata(123)\r\n\t\tthrower.should.throw('Got a number: 123.')\r\n\r\n\t\tthrower = () => validateMetadata('abc')\r\n\t\tthrower.should.throw('Got a string: abc.')\r\n\r\n\t\tthrower = () => validateMetadata({ a: true, b: 2 })\r\n\t\tthrower.should.throw('Got an object of shape: { a, b }.')\r\n\r\n\t\tthrower = () => validateMetadata({ a: true, countries: 2 })\r\n\t\tthrower.should.throw('Got an object of shape: { a, countries }.')\r\n\r\n\t\tthrower = () => validateMetadata({ country_calling_codes: true, countries: 2 })\r\n\t\tthrower.should.throw('Got an object of shape')\r\n\r\n\t\tthrower = () => validateMetadata({ country_calling_codes: {}, countries: 2 })\r\n\t\tthrower.should.throw('Got an object of shape')\r\n\r\n\t\tvalidateMetadata({ country_calling_codes: {}, countries: {}, b: 3 })\r\n\t})\r\n\r\n\tit('should work around `nonGeographical` typo in metadata generated from `1.7.35` to `1.7.37`', function() {\r\n\t\tconst meta = new Metadata(metadataV4)\r\n\t\tmeta.selectNumberingPlan('888')\r\n\t\ttype(meta.nonGeographic()).should.equal('object')\r\n\t})\r\n\r\n\tit('should work around `nonGeographic` metadata not existing before `1.7.35`', function() {\r\n\t\tconst meta = new Metadata(metadataV3)\r\n\t\ttype(meta.getNumberingPlanMetadata('800')).should.equal('object')\r\n\t\ttype(meta.getNumberingPlanMetadata('000')).should.equal('undefined')\r\n\t})\r\n\r\n\tit('should work with metadata from version `1.1.11`', function() {\r\n\t\tconst meta = new Metadata(metadataV2)\r\n\r\n\t\tmeta.selectNumberingPlan('US')\r\n\t\tmeta.numberingPlan.possibleLengths().should.deep.equal([10])\r\n\t\tmeta.numberingPlan.formats().length.should.equal(1)\r\n\t\tmeta.numberingPlan.nationalPrefix().should.equal('1')\r\n\t\tmeta.numberingPlan.nationalPrefixForParsing().should.equal('1')\r\n\t\tmeta.numberingPlan.type('MOBILE').pattern().should.equal('')\r\n\r\n\t\tmeta.selectNumberingPlan('AG')\r\n\t\tmeta.numberingPlan.leadingDigits().should.equal('268')\r\n\t\t// Should've been \"268$1\" but apparently there was a bug in metadata generator\r\n\t\t// and no national prefix transform rules were written.\r\n\t\texpect(meta.numberingPlan.nationalPrefixTransformRule()).to.be.null\r\n\r\n\t\tmeta.selectNumberingPlan('AF')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixFormattingRule().should.equal('0$1')\r\n\r\n\t\tmeta.selectNumberingPlan('RU')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsOptionalWhenFormattingInNationalFormat().should.equal(true)\r\n\t})\r\n\r\n\tit('should work with metadata from version `1.0.0`', function() {\r\n\t\tconst meta = new Metadata(metadataV1)\r\n\r\n\t\tmeta.selectNumberingPlan('US')\r\n\t\tmeta.numberingPlan.formats().length.should.equal(1)\r\n\t\tmeta.numberingPlan.nationalPrefix().should.equal('1')\r\n\t\tmeta.numberingPlan.nationalPrefixForParsing().should.equal('1')\r\n\t\ttype(meta.numberingPlan.type('MOBILE')).should.equal('undefined')\r\n\r\n\t\tmeta.selectNumberingPlan('AG')\r\n\t\tmeta.numberingPlan.leadingDigits().should.equal('268')\r\n\t\t// Should've been \"268$1\" but apparently there was a bug in metadata generator\r\n\t\t// and no national prefix transform rules were written.\r\n\t\texpect(meta.numberingPlan.nationalPrefixTransformRule()).to.be.null\r\n\r\n\t\tmeta.selectNumberingPlan('AF')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixFormattingRule().should.equal('0$1')\r\n\r\n\t\tmeta.selectNumberingPlan('RU')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsOptionalWhenFormattingInNationalFormat().should.equal(true)\r\n\t})\r\n\r\n\tit('should work around \"ext\" data not present in metadata from version `1.0.0`', function() {\r\n\t\tconst meta = new Metadata(metadataV1)\r\n\t\tmeta.selectNumberingPlan('GB')\r\n\t\tmeta.ext().should.equal(' ext. ')\r\n\r\n\t\tconst metaNew = new Metadata(metadata)\r\n\t\tmetaNew.selectNumberingPlan('GB')\r\n\t\tmetaNew.ext().should.equal(' x')\r\n\t})\r\n\r\n\tit('should work around \"default IDD prefix\" data not present in metadata from version `1.0.0`', function() {\r\n\t\tconst meta = new Metadata(metadataV1)\r\n\t\tmeta.selectNumberingPlan('AU')\r\n\t\ttype(meta.defaultIDDPrefix()).should.equal('undefined')\r\n\r\n\t\tconst metaNew = new Metadata(metadata)\r\n\t\tmetaNew.selectNumberingPlan('AU')\r\n\t\tmetaNew.defaultIDDPrefix().should.equal('0011')\r\n\t})\r\n})\r\n\r\nfunction type(something) {\r\n\treturn typeof something\r\n}"],"mappings":";;AAAA;;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AR;;AAwJA,SAASF,IAAT,CAAcuC,SAAd,EAAyB;EACxB,eAAcA,SAAd;AACA"}
|
|
1
|
+
{"version":3,"file":"metadata.test.js","names":["describe","it","FR","Metadata","metadata","country","type","should","equal","thrower","isSupportedCountry","getExtPrefix","getNumberingPlanMetadata","nationalPrefixForParsing","chooseCountryByCountryCallingCode","meta","numberingPlan","formats","nationalPrefixIsMandatoryWhenFormattingInNationalFormat","validateMetadata","a","b","countries","country_calling_codes","metadataV4","selectNumberingPlan","nonGeographic","metadataV3","metadataV2","possibleLengths","deep","length","nationalPrefix","pattern","leadingDigits","expect","nationalPrefixTransformRule","to","be","nationalPrefixFormattingRule","nationalPrefixIsOptionalWhenFormattingInNationalFormat","metadataV1","ext","metaNew","defaultIDDPrefix","something"],"sources":["../source/metadata.test.js"],"sourcesContent":["import metadata from '../metadata.min.json' assert { type: 'json' }\r\nimport metadataV1 from '../test/metadata/1.0.0/metadata.min.json' assert { type: 'json' }\r\nimport metadataV2 from '../test/metadata/1.1.11/metadata.min.json' assert { type: 'json' }\r\nimport metadataV3 from '../test/metadata/1.7.34/metadata.min.json' assert { type: 'json' }\r\nimport metadataV4 from '../test/metadata/1.7.37/metadata.min.json' assert { type: 'json' }\r\n\r\nimport Metadata, { validateMetadata, getExtPrefix, isSupportedCountry } from './metadata.js'\r\n\r\ndescribe('metadata', () => {\r\n\tit('should return undefined for non-defined types', () => {\r\n\t\tconst FR = new Metadata(metadata).country('FR')\r\n\t\ttype(FR.type('FIXED_LINE')).should.equal('undefined')\r\n\t})\r\n\r\n\tit('should validate country', () => {\r\n\t\tconst thrower = () => new Metadata(metadata).country('RUS')\r\n\t\tthrower.should.throw('Unknown country')\r\n\t})\r\n\r\n\tit('should tell if a country is supported', () => {\r\n\t\tisSupportedCountry('RU', metadata).should.equal(true)\r\n\t\tisSupportedCountry('XX', metadata).should.equal(false)\r\n\t})\r\n\r\n\tit('should return ext prefix for a country', () => {\r\n\t\tgetExtPrefix('US', metadata).should.equal(' ext. ')\r\n\t\tgetExtPrefix('CA', metadata).should.equal(' ext. ')\r\n\t\tgetExtPrefix('GB', metadata).should.equal(' x')\r\n\t\t// expect(getExtPrefix('XX', metadata)).to.equal(undefined)\r\n\t\tgetExtPrefix('XX', metadata).should.equal(' ext. ')\r\n\t})\r\n\r\n\tit('should cover non-occuring edge cases', () => {\r\n\t\tnew Metadata(metadata).getNumberingPlanMetadata('999')\r\n\t})\r\n\r\n\tit('should support deprecated methods', () => {\r\n\t\tnew Metadata(metadata).country('US').nationalPrefixForParsing().should.equal('1')\r\n\t\tnew Metadata(metadata).chooseCountryByCountryCallingCode('1').nationalPrefixForParsing().should.equal('1')\r\n\t})\r\n\r\n\tit('should tell if a national prefix is mandatory when formatting a national number', () => {\r\n\t\tconst meta = new Metadata(metadata)\r\n\t\t// No \"national_prefix_formatting_rule\".\r\n\t\t// \"national_prefix_is_optional_when_formatting\": true\r\n\t\tmeta.country('US')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsMandatoryWhenFormattingInNationalFormat().should.equal(false)\r\n\t\t// \"national_prefix_formatting_rule\": \"8 ($1)\"\r\n\t\t// \"national_prefix_is_optional_when_formatting\": true\r\n\t\tmeta.country('RU')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsMandatoryWhenFormattingInNationalFormat().should.equal(false)\r\n\t\t// \"national_prefix\": \"0\"\r\n\t\t// \"national_prefix_formatting_rule\": \"0 $1\"\r\n\t\tmeta.country('FR')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsMandatoryWhenFormattingInNationalFormat().should.equal(true)\r\n\t})\r\n\r\n\tit('should validate metadata', () => {\r\n\t\tlet thrower = () => validateMetadata()\r\n\t\tthrower.should.throw('`metadata` argument not passed')\r\n\r\n\t\tthrower = () => validateMetadata(123)\r\n\t\tthrower.should.throw('Got a number: 123.')\r\n\r\n\t\tthrower = () => validateMetadata('abc')\r\n\t\tthrower.should.throw('Got a string: abc.')\r\n\r\n\t\tthrower = () => validateMetadata({ a: true, b: 2 })\r\n\t\tthrower.should.throw('Got an object of shape: { a, b }.')\r\n\r\n\t\tthrower = () => validateMetadata({ a: true, countries: 2 })\r\n\t\tthrower.should.throw('Got an object of shape: { a, countries }.')\r\n\r\n\t\tthrower = () => validateMetadata({ country_calling_codes: true, countries: 2 })\r\n\t\tthrower.should.throw('Got an object of shape')\r\n\r\n\t\tthrower = () => validateMetadata({ country_calling_codes: {}, countries: 2 })\r\n\t\tthrower.should.throw('Got an object of shape')\r\n\r\n\t\tvalidateMetadata({ country_calling_codes: {}, countries: {}, b: 3 })\r\n\t})\r\n\r\n\tit('should work around `nonGeographical` typo in metadata generated from `1.7.35` to `1.7.37`', function() {\r\n\t\tconst meta = new Metadata(metadataV4)\r\n\t\tmeta.selectNumberingPlan('888')\r\n\t\ttype(meta.nonGeographic()).should.equal('object')\r\n\t})\r\n\r\n\tit('should work around `nonGeographic` metadata not existing before `1.7.35`', function() {\r\n\t\tconst meta = new Metadata(metadataV3)\r\n\t\ttype(meta.getNumberingPlanMetadata('800')).should.equal('object')\r\n\t\ttype(meta.getNumberingPlanMetadata('000')).should.equal('undefined')\r\n\t})\r\n\r\n\tit('should work with metadata from version `1.1.11`', function() {\r\n\t\tconst meta = new Metadata(metadataV2)\r\n\r\n\t\tmeta.selectNumberingPlan('US')\r\n\t\tmeta.numberingPlan.possibleLengths().should.deep.equal([10])\r\n\t\tmeta.numberingPlan.formats().length.should.equal(1)\r\n\t\tmeta.numberingPlan.nationalPrefix().should.equal('1')\r\n\t\tmeta.numberingPlan.nationalPrefixForParsing().should.equal('1')\r\n\t\tmeta.numberingPlan.type('MOBILE').pattern().should.equal('')\r\n\r\n\t\tmeta.selectNumberingPlan('AG')\r\n\t\tmeta.numberingPlan.leadingDigits().should.equal('268')\r\n\t\t// Should've been \"268$1\" but apparently there was a bug in metadata generator\r\n\t\t// and no national prefix transform rules were written.\r\n\t\texpect(meta.numberingPlan.nationalPrefixTransformRule()).to.be.null\r\n\r\n\t\tmeta.selectNumberingPlan('AF')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixFormattingRule().should.equal('0$1')\r\n\r\n\t\tmeta.selectNumberingPlan('RU')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsOptionalWhenFormattingInNationalFormat().should.equal(true)\r\n\t})\r\n\r\n\tit('should work with metadata from version `1.0.0`', function() {\r\n\t\tconst meta = new Metadata(metadataV1)\r\n\r\n\t\tmeta.selectNumberingPlan('US')\r\n\t\tmeta.numberingPlan.formats().length.should.equal(1)\r\n\t\tmeta.numberingPlan.nationalPrefix().should.equal('1')\r\n\t\tmeta.numberingPlan.nationalPrefixForParsing().should.equal('1')\r\n\t\ttype(meta.numberingPlan.type('MOBILE')).should.equal('undefined')\r\n\r\n\t\tmeta.selectNumberingPlan('AG')\r\n\t\tmeta.numberingPlan.leadingDigits().should.equal('268')\r\n\t\t// Should've been \"268$1\" but apparently there was a bug in metadata generator\r\n\t\t// and no national prefix transform rules were written.\r\n\t\texpect(meta.numberingPlan.nationalPrefixTransformRule()).to.be.null\r\n\r\n\t\tmeta.selectNumberingPlan('AF')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixFormattingRule().should.equal('0$1')\r\n\r\n\t\tmeta.selectNumberingPlan('RU')\r\n\t\tmeta.numberingPlan.formats()[0].nationalPrefixIsOptionalWhenFormattingInNationalFormat().should.equal(true)\r\n\t})\r\n\r\n\tit('should work around \"ext\" data not present in metadata from version `1.0.0`', function() {\r\n\t\tconst meta = new Metadata(metadataV1)\r\n\t\tmeta.selectNumberingPlan('GB')\r\n\t\tmeta.ext().should.equal(' ext. ')\r\n\r\n\t\tconst metaNew = new Metadata(metadata)\r\n\t\tmetaNew.selectNumberingPlan('GB')\r\n\t\tmetaNew.ext().should.equal(' x')\r\n\t})\r\n\r\n\tit('should work around \"default IDD prefix\" data not present in metadata from version `1.0.0`', function() {\r\n\t\tconst meta = new Metadata(metadataV1)\r\n\t\tmeta.selectNumberingPlan('AU')\r\n\t\ttype(meta.defaultIDDPrefix()).should.equal('undefined')\r\n\r\n\t\tconst metaNew = new Metadata(metadata)\r\n\t\tmetaNew.selectNumberingPlan('AU')\r\n\t\tmetaNew.defaultIDDPrefix().should.equal('0011')\r\n\t})\r\n})\r\n\r\nfunction type(something) {\r\n\treturn typeof something\r\n}"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAEAA,QAAQ,CAAC,UAAD,EAAa,YAAM;EAC1BC,EAAE,CAAC,+CAAD,EAAkD,YAAM;IACzD,IAAMC,EAAE,GAAG,IAAIC,oBAAJ,CAAaC,uBAAb,EAAuBC,OAAvB,CAA+B,IAA/B,CAAX;IACAC,IAAI,CAACJ,EAAE,CAACI,IAAH,CAAQ,YAAR,CAAD,CAAJ,CAA4BC,MAA5B,CAAmCC,KAAnC,CAAyC,WAAzC;EACA,CAHC,CAAF;EAKAP,EAAE,CAAC,yBAAD,EAA4B,YAAM;IACnC,IAAMQ,OAAO,GAAG,SAAVA,OAAU;MAAA,OAAM,IAAIN,oBAAJ,CAAaC,uBAAb,EAAuBC,OAAvB,CAA+B,KAA/B,CAAN;IAAA,CAAhB;;IACAI,OAAO,CAACF,MAAR,UAAqB,iBAArB;EACA,CAHC,CAAF;EAKAN,EAAE,CAAC,uCAAD,EAA0C,YAAM;IACjD,IAAAS,4BAAA,EAAmB,IAAnB,EAAyBN,uBAAzB,EAAmCG,MAAnC,CAA0CC,KAA1C,CAAgD,IAAhD;IACA,IAAAE,4BAAA,EAAmB,IAAnB,EAAyBN,uBAAzB,EAAmCG,MAAnC,CAA0CC,KAA1C,CAAgD,KAAhD;EACA,CAHC,CAAF;EAKAP,EAAE,CAAC,wCAAD,EAA2C,YAAM;IAClD,IAAAU,sBAAA,EAAa,IAAb,EAAmBP,uBAAnB,EAA6BG,MAA7B,CAAoCC,KAApC,CAA0C,QAA1C;IACA,IAAAG,sBAAA,EAAa,IAAb,EAAmBP,uBAAnB,EAA6BG,MAA7B,CAA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A3C;IAEA,IAAMmC,OAAO,GAAG,IAAIxC,oBAAJ,CAAaC,uBAAb,CAAhB;IACAuC,OAAO,CAAClB,mBAAR,CAA4B,IAA5B;IACAkB,OAAO,CAACC,gBAAR,GAA2BrC,MAA3B,CAAkCC,KAAlC,CAAwC,MAAxC;EACA,CARC,CAAF;AASA,CAtJO,CAAR;;AAwJA,SAASF,IAAT,CAAcuC,SAAd,EAAyB;EACxB,eAAcA,SAAd;AACA"}
|
package/build/parse.test.js.map
CHANGED
|
@@ -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/parse.test.js"],"sourcesContent":["import metadata from '../metadata.min.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\tparseNumber('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// Mobile.\r\n\t\t// `1` is prepended before area code to mobile numbers in international format.\r\n\t\tparseNumber('+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\tparseNumber('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\tparseNumber('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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;EACA,CALC,CAAF;AAMA,CAhgBO,CAAR"}
|
|
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/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\tparseNumber('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// Mobile.\r\n\t\t// `1` is prepended before area code to mobile numbers in international format.\r\n\t\tparseNumber('+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\tparseNumber('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\tparseNumber('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,mBAA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ACAX,WAAW,CAAC,yBAAD,EAA4B,IAA5B,CAAX,CAA6CmB,GAA7C,CAAiDV,MAAjD,CAAwDE,KAAxD,CAA8D,WAA9D;IACAX,WAAW,CAAC,wBAAD,EAA2B,IAA3B,CAAX,CAA4CmB,GAA5C,CAAgDV,MAAhD,CAAuDE,KAAvD,CAA6D,WAA7D;IACAX,WAAW,CAAC,wBAAD,EAA2B,IAA3B,CAAX,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,CAhgBO,CAAR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsePhoneNumber.test.js","names":["parsePhoneNumber","parameters","push","metadata","_parsePhoneNumber","apply","parsePhoneNumberFull","metadataFull","describe","it","phoneNumber","country","should","equal","countryCallingCode","nationalNumber","number","isPossible","isValid","getType","expect","to","be","undefined","carrierCode","ext","format","formatNational","formatInternational","getURI"],"sources":["../source/parsePhoneNumber.test.js"],"sourcesContent":["import _parsePhoneNumber from './parsePhoneNumber.js'\r\nimport metadata from '../metadata.min.json'\r\nimport metadataFull from '../metadata.max.json'\r\n\r\nfunction parsePhoneNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _parsePhoneNumber.apply(this, parameters)\r\n}\r\n\r\nfunction parsePhoneNumberFull(...parameters) {\r\n\tparameters.push(metadataFull)\r\n\treturn _parsePhoneNumber.apply(this, parameters)\r\n}\r\n\r\ndescribe('parsePhoneNumber', () => {\r\n\tit('should parse phone numbers', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('Phone: 8 (800) 555 35 35.', 'RU')\r\n\t\tphoneNumber.country.should.equal('RU')\r\n\t\tphoneNumber.countryCallingCode.should.equal('7')\r\n\t\tphoneNumber.nationalNumber.should.equal('8005553535')\r\n\t\tphoneNumber.number.should.equal('+78005553535')\r\n\t\tphoneNumber.isPossible().should.equal(true)\r\n\t\tphoneNumber.isValid().should.equal(true)\r\n\t\t// phoneNumber.isValidForRegion('RU').should.equal(true)\r\n\t\t// Russian phone type regexps aren't included in default metadata.\r\n\t\tparsePhoneNumberFull('Phone: 8 (800) 555 35 35.', 'RU').getType().should.equal('TOLL_FREE')\r\n\t})\r\n\r\n\tit('shouldn\\'t set country when it\\'s non-derivable', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('+7 111 555 35 35')\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.countryCallingCode.should.equal('7')\r\n\t\tphoneNumber.nationalNumber.should.equal('1115553535')\r\n\t})\r\n\r\n\tit('should parse carrier code', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('0 15 21 5555-5555', 'BR')\r\n\t\tphoneNumber.carrierCode.should.equal('15')\r\n\t})\r\n\r\n\tit('should parse phone extension', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('Phone: 8 (800) 555 35 35 ext. 1234.', 'RU')\r\n\t\tphoneNumber.ext.should.equal('1234')\r\n\t})\r\n\r\n\tit('should validate numbers for countries with no type regular expressions', () => {\r\n\t\tparsePhoneNumber('+380391234567').isValid().should.equal(true)\r\n\t\tparsePhoneNumber('+380191234567').isValid().should.equal(false)\r\n\t})\r\n\r\n\tit('should format numbers', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('Phone: 8 (800) 555 35 35.', 'RU')\r\n\t\tphoneNumber.format('NATIONAL').should.equal('8 (800) 555-35-35')\r\n\t\tphoneNumber.formatNational().should.equal('8 (800) 555-35-35')\r\n\t\tphoneNumber.format('INTERNATIONAL').should.equal('+7 800 555 35 35')\r\n\t\tphoneNumber.formatInternational().should.equal('+7 800 555 35 35')\r\n\t})\r\n\r\n\tit('should get tel: URI', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('Phone: 8 (800) 555 35 35 ext. 1234.', 'RU')\r\n\t\tphoneNumber.getURI().should.equal('tel:+78005553535;ext=1234')\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\texpect(() => parsePhoneNumber('+78005553535', -1, {})).to.throw('Invalid second argument')\r\n\t})\r\n\r\n\tit('should throw parse errors', () => {\r\n\t\texpect(() => parsePhoneNumber('8005553535', 'XX')).to.throw('INVALID_COUNTRY')\r\n\t\texpect(() => parsePhoneNumber('+', 'RU')).to.throw('NOT_A_NUMBER')\r\n\t\texpect(() => parsePhoneNumber('a', 'RU')).to.throw('NOT_A_NUMBER')\r\n\t\texpect(() => parsePhoneNumber('1', 'RU')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('+4')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('+44')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('+443')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('+370')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('88888888888888888888', 'RU')).to.throw('TOO_LONG')\r\n\t\texpect(() => parsePhoneNumber('8 (800) 555 35 35')).to.throw('INVALID_COUNTRY')\r\n\t\texpect(() => parsePhoneNumber('+9991112233')).to.throw('INVALID_COUNTRY')\r\n\t\texpect(() => parsePhoneNumber('+9991112233', 'US')).to.throw('INVALID_COUNTRY')\r\n\t\texpect(() => parsePhoneNumber('8005553535 ', 'RU')).to.throw('TOO_LONG')\r\n\t})\r\n\r\n\tit('should parse incorrect international phone numbers', () => {\r\n\t\t// Parsing national prefixes and carrier codes\r\n\t\t// is only required for local phone numbers\r\n\t\t// but some people don't understand that\r\n\t\t// and sometimes write international phone numbers\r\n\t\t// with national prefixes (or maybe even carrier codes).\r\n\t\t// http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\r\n\t\t// Google's original library forgives such mistakes\r\n\t\t// and so does this library, because it has been requested:\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/127\r\n\r\n\t\tlet phoneNumber\r\n\r\n\t\t// For complete numbers it should strip national prefix.\r\n\t\tphoneNumber = parsePhoneNumber('+1 1877 215 5230')\r\n\t\tphoneNumber.nationalNumber.should.equal('8772155230')\r\n\t\tphoneNumber.country.should.equal('US')\r\n\r\n\t\t// For complete numbers it should strip national prefix.\r\n\t\tphoneNumber = parsePhoneNumber('+7 8800 555 3535')\r\n\t\tphoneNumber.nationalNumber.should.equal('8005553535')\r\n\t\tphoneNumber.country.should.equal('RU')\r\n\r\n\t\t// For incomplete numbers it shouldn't strip national prefix.\r\n\t\tphoneNumber = parsePhoneNumber('+7 8800 555 353')\r\n\t\tphoneNumber.nationalNumber.should.equal('8800555353')\r\n\t\tphoneNumber.country.should.equal('RU')\r\n\t})\r\n})\r\n"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,SAASA,gBAAT,GAAyC;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EACxCA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,6BAAA,CAAkBC,KAAlB,CAAwB,IAAxB,EAA8BJ,UAA9B,CAAP;AACA;;AAED,SAASK,oBA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Z,CAA2BH,MAA3B,CAAkCC,KAAlC,CAAwC,YAAxC;IACAH,WAAW,CAACC,OAAZ,CAAoBC,MAApB,CAA2BC,KAA3B,CAAiC,IAAjC;EACA,CA3BC,CAAF;AA4BA,CAjGO,CAAR"}
|
|
1
|
+
{"version":3,"file":"parsePhoneNumber.test.js","names":["parsePhoneNumber","parameters","push","metadata","_parsePhoneNumber","apply","parsePhoneNumberFull","metadataFull","describe","it","phoneNumber","country","should","equal","countryCallingCode","nationalNumber","number","isPossible","isValid","getType","expect","to","be","undefined","carrierCode","ext","format","formatNational","formatInternational","getURI"],"sources":["../source/parsePhoneNumber.test.js"],"sourcesContent":["import _parsePhoneNumber from './parsePhoneNumber.js'\r\nimport metadata from '../metadata.min.json' assert { type: 'json' }\r\nimport metadataFull from '../metadata.max.json' assert { type: 'json' }\r\n\r\nfunction parsePhoneNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _parsePhoneNumber.apply(this, parameters)\r\n}\r\n\r\nfunction parsePhoneNumberFull(...parameters) {\r\n\tparameters.push(metadataFull)\r\n\treturn _parsePhoneNumber.apply(this, parameters)\r\n}\r\n\r\ndescribe('parsePhoneNumber', () => {\r\n\tit('should parse phone numbers', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('Phone: 8 (800) 555 35 35.', 'RU')\r\n\t\tphoneNumber.country.should.equal('RU')\r\n\t\tphoneNumber.countryCallingCode.should.equal('7')\r\n\t\tphoneNumber.nationalNumber.should.equal('8005553535')\r\n\t\tphoneNumber.number.should.equal('+78005553535')\r\n\t\tphoneNumber.isPossible().should.equal(true)\r\n\t\tphoneNumber.isValid().should.equal(true)\r\n\t\t// phoneNumber.isValidForRegion('RU').should.equal(true)\r\n\t\t// Russian phone type regexps aren't included in default metadata.\r\n\t\tparsePhoneNumberFull('Phone: 8 (800) 555 35 35.', 'RU').getType().should.equal('TOLL_FREE')\r\n\t})\r\n\r\n\tit('shouldn\\'t set country when it\\'s non-derivable', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('+7 111 555 35 35')\r\n\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\tphoneNumber.countryCallingCode.should.equal('7')\r\n\t\tphoneNumber.nationalNumber.should.equal('1115553535')\r\n\t})\r\n\r\n\tit('should parse carrier code', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('0 15 21 5555-5555', 'BR')\r\n\t\tphoneNumber.carrierCode.should.equal('15')\r\n\t})\r\n\r\n\tit('should parse phone extension', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('Phone: 8 (800) 555 35 35 ext. 1234.', 'RU')\r\n\t\tphoneNumber.ext.should.equal('1234')\r\n\t})\r\n\r\n\tit('should validate numbers for countries with no type regular expressions', () => {\r\n\t\tparsePhoneNumber('+380391234567').isValid().should.equal(true)\r\n\t\tparsePhoneNumber('+380191234567').isValid().should.equal(false)\r\n\t})\r\n\r\n\tit('should format numbers', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('Phone: 8 (800) 555 35 35.', 'RU')\r\n\t\tphoneNumber.format('NATIONAL').should.equal('8 (800) 555-35-35')\r\n\t\tphoneNumber.formatNational().should.equal('8 (800) 555-35-35')\r\n\t\tphoneNumber.format('INTERNATIONAL').should.equal('+7 800 555 35 35')\r\n\t\tphoneNumber.formatInternational().should.equal('+7 800 555 35 35')\r\n\t})\r\n\r\n\tit('should get tel: URI', () => {\r\n\t\tconst phoneNumber = parsePhoneNumber('Phone: 8 (800) 555 35 35 ext. 1234.', 'RU')\r\n\t\tphoneNumber.getURI().should.equal('tel:+78005553535;ext=1234')\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\texpect(() => parsePhoneNumber('+78005553535', -1, {})).to.throw('Invalid second argument')\r\n\t})\r\n\r\n\tit('should throw parse errors', () => {\r\n\t\texpect(() => parsePhoneNumber('8005553535', 'XX')).to.throw('INVALID_COUNTRY')\r\n\t\texpect(() => parsePhoneNumber('+', 'RU')).to.throw('NOT_A_NUMBER')\r\n\t\texpect(() => parsePhoneNumber('a', 'RU')).to.throw('NOT_A_NUMBER')\r\n\t\texpect(() => parsePhoneNumber('1', 'RU')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('+4')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('+44')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('+443')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('+370')).to.throw('TOO_SHORT')\r\n\t\texpect(() => parsePhoneNumber('88888888888888888888', 'RU')).to.throw('TOO_LONG')\r\n\t\texpect(() => parsePhoneNumber('8 (800) 555 35 35')).to.throw('INVALID_COUNTRY')\r\n\t\texpect(() => parsePhoneNumber('+9991112233')).to.throw('INVALID_COUNTRY')\r\n\t\texpect(() => parsePhoneNumber('+9991112233', 'US')).to.throw('INVALID_COUNTRY')\r\n\t\texpect(() => parsePhoneNumber('8005553535 ', 'RU')).to.throw('TOO_LONG')\r\n\t})\r\n\r\n\tit('should parse incorrect international phone numbers', () => {\r\n\t\t// Parsing national prefixes and carrier codes\r\n\t\t// is only required for local phone numbers\r\n\t\t// but some people don't understand that\r\n\t\t// and sometimes write international phone numbers\r\n\t\t// with national prefixes (or maybe even carrier codes).\r\n\t\t// http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\r\n\t\t// Google's original library forgives such mistakes\r\n\t\t// and so does this library, because it has been requested:\r\n\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/127\r\n\r\n\t\tlet phoneNumber\r\n\r\n\t\t// For complete numbers it should strip national prefix.\r\n\t\tphoneNumber = parsePhoneNumber('+1 1877 215 5230')\r\n\t\tphoneNumber.nationalNumber.should.equal('8772155230')\r\n\t\tphoneNumber.country.should.equal('US')\r\n\r\n\t\t// For complete numbers it should strip national prefix.\r\n\t\tphoneNumber = parsePhoneNumber('+7 8800 555 3535')\r\n\t\tphoneNumber.nationalNumber.should.equal('8005553535')\r\n\t\tphoneNumber.country.should.equal('RU')\r\n\r\n\t\t// For incomplete numbers it shouldn't strip national prefix.\r\n\t\tphoneNumber = parsePhoneNumber('+7 8800 555 353')\r\n\t\tphoneNumber.nationalNumber.should.equal('8800555353')\r\n\t\tphoneNumber.country.should.equal('RU')\r\n\t})\r\n})\r\n"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEA,SAASA,gBAAT,GAAyC;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EACxCA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,6BAAA,CAAkBC,KAAlB,CAAwB,IAAxB,EAA8BJ,UAA9B,CAAP;AACA;;AAED,SAASK,oBAAT,GAA6C;EAAA,mCAAZL,UAAY;IAAZA,UAAY;EAAA;;EAC5CA,UAAU,CAACC,IAAX,CAAgBK,uBAAhB;EACA,OAAOH,6BAAA,CAAkBC,KAAlB,CAAwB,IAAxB,EAA8BJ,UAA9B,CAAP;AACA;;AAEDO,QAAQ,CAAC,kBAAD,EAAqB,YAAM;EAClCC,EAAE,CAAC,4BAAD,EAA+B,YAAM;IACtC,IAAMC,WAAW,GAAGV,gBAAgB,CAAC,2BAAD,EAA8B,IAA9B,CAApC;IACAU,WAAW,CAACC,OAAZ,CAAoBC,MAApB,CAA2BC,KAA3B,CAAiC,IAAjC;IACAH,WAAW,CAACI,kBAAZ,CAA+BF,MAA/B,CAAsCC,KAAtC,CAA4C,GAA5C;IACAH,WAAW,CAACK,cAAZ,CAA2BH,MAA3B,CAAkCC,KAAlC,CAAwC,YAAxC;IACAH,WAAW,CAACM,MAAZ,CAAmBJ,MAAnB,CAA0BC,KAA1B,CAAgC,cAAhC;IACAH,WAAW,CAACO,UAAZ,GAAyBL,MAAzB,CAAgCC,KAAhC,CAAsC,IAAtC;IACAH,WAAW,CAACQ,OAAZ,GAAsBN,MAAtB,CAA6BC,KAA7B,CAAmC,IAAnC,EAPsC,CAQtC;IACA;;IACAP,oBAAoB,CAAC,2BAAD,EAA8B,IAA9B,CAApB,CAAwDa,O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H,MAA3B,CAAkCC,KAAlC,CAAwC,YAAxC;IACAH,WAAW,CAACC,OAAZ,CAAoBC,MAApB,CAA2BC,KAA3B,CAAiC,IAAjC,EAhB8D,CAkB9D;;IACAH,WAAW,GAAGV,gBAAgB,CAAC,kBAAD,CAA9B;IACAU,WAAW,CAACK,cAAZ,CAA2BH,MAA3B,CAAkCC,KAAlC,CAAwC,YAAxC;IACAH,WAAW,CAACC,OAAZ,CAAoBC,MAApB,CAA2BC,KAA3B,CAAiC,IAAjC,EArB8D,CAuB9D;;IACAH,WAAW,GAAGV,gBAAgB,CAAC,iBAAD,CAA9B;IACAU,WAAW,CAACK,cAAZ,CAA2BH,MAA3B,CAAkCC,KAAlC,CAAwC,YAAxC;IACAH,WAAW,CAACC,OAAZ,CAAoBC,MAApB,CAA2BC,KAA3B,CAAiC,IAAjC;EACA,CA3BC,CAAF;AA4BA,CAjGO,CAAR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsePhoneNumberFromString.test.js","names":["parsePhoneNumberFromString","parameters","push","metadata","_parsePhoneNumberFromString","apply","USE_NON_GEOGRAPHIC_COUNTRY_CODE","describe","it","nationalNumber","should","equal","expect","to","be","undefined","phoneNumber","number","country","countryCallingCode","defaultCallingCode","isPossible","phoneNumber2","testCorrectness","expectedResult","result","extract","defaultCountry","not","isValid"],"sources":["../source/parsePhoneNumberFromString.test.js"],"sourcesContent":["import _parsePhoneNumberFromString from './parsePhoneNumberFromString.js'\r\nimport metadata from '../metadata.min.json'\r\n\r\nfunction parsePhoneNumberFromString(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _parsePhoneNumberFromString.apply(this, parameters)\r\n}\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\ndescribe('parsePhoneNumberFromString', () => {\r\n\tit('should parse phone numbers from string', () => {\r\n\t\tparsePhoneNumberFromString('Phone: 8 (800) 555 35 35.', 'RU').nationalNumber.should.equal('8005553535')\r\n\t\texpect(parsePhoneNumberFromString('3', 'RU')).to.be.undefined\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\texpect(parsePhoneNumberFromString('')).to.be.undefined\r\n\t})\r\n\r\n\tit('should parse phone numbers when invalid country code is passed', () => {\r\n\t\tparsePhoneNumberFromString('Phone: +7 (800) 555 35 35.', 'XX').nationalNumber.should.equal('8005553535')\r\n\t\texpect(parsePhoneNumberFromString('Phone: 8 (800) 555-35-35.', 'XX')).to.be.undefined\r\n\t})\r\n\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (extended)', () => {\r\n\t\tconst phoneNumber = parsePhoneNumberFromString('+870773111632')\r\n\t\tphoneNumber.number.should.equal('+870773111632')\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\tphoneNumber.country.should.equal('001')\r\n\t\t} else {\r\n\t\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\t}\r\n\t\tphoneNumber.countryCallingCode.should.equal('870')\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (default country code) (extended)', () => {\r\n\t\tconst phoneNumber = parsePhoneNumberFromString('773111632', { defaultCallingCode: '870' })\r\n\t\tphoneNumber.number.should.equal('+870773111632')\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\tphoneNumber.country.should.equal('001')\r\n\t\t} else {\r\n\t\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\t}\r\n\t\tphoneNumber.countryCallingCode.should.equal('870')\r\n\t})\r\n\r\n\tit('should determine the possibility of non-geographic phone numbers', () => {\r\n\t\tconst phoneNumber = parsePhoneNumberFromString('+870773111632')\r\n\t\tphoneNumber.isPossible().should.equal(true)\r\n\t\tconst phoneNumber2 = parsePhoneNumberFromString('+8707731116321')\r\n\t\tphoneNumber2.isPossible().should.equal(false)\r\n\t})\r\n\r\n\tit('should support `extract: false` flag', () => {\r\n\t\tconst testCorrectness = (number, expectedResult) => {\r\n\t\t\tconst result = expect(parsePhoneNumberFromString(number, { extract: false, defaultCountry: 'US' }))\r\n\t\t\tif (expectedResult) {\r\n\t\t\t\tresult.to.not.be.undefined\r\n\t\t\t} else {\r\n\t\t\t\tresult.to.be.undefined\r\n\t\t\t}\r\n\t\t}\r\n\t\ttestCorrectness('Call: (213) 373-4253', false)\r\n\t\ttestCorrectness('(213) 373-4253x', false)\r\n\t\ttestCorrectness('(213) 373-4253', true)\r\n\t\ttestCorrectness('- (213) 373-4253 -', true)\r\n\t\ttestCorrectness('+1 (213) 373-4253', true)\r\n\t\ttestCorrectness(' +1 (213) 373-4253', false)\r\n\t})\r\n\r\n\tit('should not prematurely strip a possible national prefix from Chinese numbers', () => {\r\n\t\t// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57\r\n\t\tconst phoneNumber = parsePhoneNumberFromString('+86123456789')\r\n\t\tphoneNumber.isPossible().should.equal(true)\r\n\t\tphoneNumber.isValid().should.equal(false)\r\n\t\tphoneNumber.nationalNumber.should.equal('123456789')\r\n\t})\r\n})\r\n"],"mappings":";;AAAA;;AACA;;;;AAEA,SAASA,0BAAT,GAAmD;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EAClDA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,uCAAA,CAA4BC,KAA5B,CAAkC,IAAlC,EAAwCJ,UAAxC,CAAP;AACA;;AAED,IAAMK,+BAA+B,GAAG,KAAxC;AAEAC,QAAQ,CAAC,4BAAD,EAA+B,YAAM;EAC5CC,EAAE,CAAC,wCAAD,EAA2C,YAAM;IAClDR,0BAA0B,CAAC,2BAAD,EAA8B,IAA9B,CAA1B,CAA8DS,cAA9D,CAA6EC,MAA7E,CAAoFC,KAApF,CAA0F,YAA1F;IACAC,MAAM,CAACZ,0BAA0B,CAAC,GAAD,EAAM,IAAN,CAA3B,CAAN,CAA8Ca,EAA9C,CAAiDC,EAAjD,CAAoDC,SAApD;EACA,CAHC,CAAF;EAKAP,EAAE,CAAC,2BAAD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F,YAAM;IACxF;IACA,IAAMQ,WAAW,GAAGhB,0BAA0B,CAAC,cAAD,CAA9C;IACAgB,WAAW,CAACK,UAAZ,GAAyBX,MAAzB,CAAgCC,KAAhC,CAAsC,IAAtC;IACAK,WAAW,CAACa,OAAZ,GAAsBnB,MAAtB,CAA6BC,KAA7B,CAAmC,KAAnC;IACAK,WAAW,CAACP,cAAZ,CAA2BC,MAA3B,CAAkCC,KAAlC,CAAwC,WAAxC;EACA,CANC,CAAF;AAOA,CArEO,CAAR"}
|
|
1
|
+
{"version":3,"file":"parsePhoneNumberFromString.test.js","names":["parsePhoneNumberFromString","parameters","push","metadata","_parsePhoneNumberFromString","apply","USE_NON_GEOGRAPHIC_COUNTRY_CODE","describe","it","nationalNumber","should","equal","expect","to","be","undefined","phoneNumber","number","country","countryCallingCode","defaultCallingCode","isPossible","phoneNumber2","testCorrectness","expectedResult","result","extract","defaultCountry","not","isValid"],"sources":["../source/parsePhoneNumberFromString.test.js"],"sourcesContent":["import _parsePhoneNumberFromString from './parsePhoneNumberFromString.js'\r\nimport metadata from '../metadata.min.json' assert { type: 'json' }\r\n\r\nfunction parsePhoneNumberFromString(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _parsePhoneNumberFromString.apply(this, parameters)\r\n}\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\ndescribe('parsePhoneNumberFromString', () => {\r\n\tit('should parse phone numbers from string', () => {\r\n\t\tparsePhoneNumberFromString('Phone: 8 (800) 555 35 35.', 'RU').nationalNumber.should.equal('8005553535')\r\n\t\texpect(parsePhoneNumberFromString('3', 'RU')).to.be.undefined\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\texpect(parsePhoneNumberFromString('')).to.be.undefined\r\n\t})\r\n\r\n\tit('should parse phone numbers when invalid country code is passed', () => {\r\n\t\tparsePhoneNumberFromString('Phone: +7 (800) 555 35 35.', 'XX').nationalNumber.should.equal('8005553535')\r\n\t\texpect(parsePhoneNumberFromString('Phone: 8 (800) 555-35-35.', 'XX')).to.be.undefined\r\n\t})\r\n\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (extended)', () => {\r\n\t\tconst phoneNumber = parsePhoneNumberFromString('+870773111632')\r\n\t\tphoneNumber.number.should.equal('+870773111632')\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\tphoneNumber.country.should.equal('001')\r\n\t\t} else {\r\n\t\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\t}\r\n\t\tphoneNumber.countryCallingCode.should.equal('870')\r\n\t})\r\n\r\n\tit('should parse non-geographic numbering plan phone numbers (default country code) (extended)', () => {\r\n\t\tconst phoneNumber = parsePhoneNumberFromString('773111632', { defaultCallingCode: '870' })\r\n\t\tphoneNumber.number.should.equal('+870773111632')\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\tphoneNumber.country.should.equal('001')\r\n\t\t} else {\r\n\t\t\texpect(phoneNumber.country).to.be.undefined\r\n\t\t}\r\n\t\tphoneNumber.countryCallingCode.should.equal('870')\r\n\t})\r\n\r\n\tit('should determine the possibility of non-geographic phone numbers', () => {\r\n\t\tconst phoneNumber = parsePhoneNumberFromString('+870773111632')\r\n\t\tphoneNumber.isPossible().should.equal(true)\r\n\t\tconst phoneNumber2 = parsePhoneNumberFromString('+8707731116321')\r\n\t\tphoneNumber2.isPossible().should.equal(false)\r\n\t})\r\n\r\n\tit('should support `extract: false` flag', () => {\r\n\t\tconst testCorrectness = (number, expectedResult) => {\r\n\t\t\tconst result = expect(parsePhoneNumberFromString(number, { extract: false, defaultCountry: 'US' }))\r\n\t\t\tif (expectedResult) {\r\n\t\t\t\tresult.to.not.be.undefined\r\n\t\t\t} else {\r\n\t\t\t\tresult.to.be.undefined\r\n\t\t\t}\r\n\t\t}\r\n\t\ttestCorrectness('Call: (213) 373-4253', false)\r\n\t\ttestCorrectness('(213) 373-4253x', false)\r\n\t\ttestCorrectness('(213) 373-4253', true)\r\n\t\ttestCorrectness('- (213) 373-4253 -', true)\r\n\t\ttestCorrectness('+1 (213) 373-4253', true)\r\n\t\ttestCorrectness(' +1 (213) 373-4253', false)\r\n\t})\r\n\r\n\tit('should not prematurely strip a possible national prefix from Chinese numbers', () => {\r\n\t\t// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57\r\n\t\tconst phoneNumber = parsePhoneNumberFromString('+86123456789')\r\n\t\tphoneNumber.isPossible().should.equal(true)\r\n\t\tphoneNumber.isValid().should.equal(false)\r\n\t\tphoneNumber.nationalNumber.should.equal('123456789')\r\n\t})\r\n})\r\n"],"mappings":";;AAAA;;AACA;;;;AAEA,SAASA,0BAAT,GAAmD;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EAClDA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,uCAAA,CAA4BC,KAA5B,CAAkC,IAAlC,EAAwCJ,UAAxC,CAAP;AACA;;AAED,IAAMK,+BAA+B,GAAG,KAAxC;AAEAC,QAAQ,CAAC,4BAAD,EAA+B,YAAM;EAC5CC,EAAE,CAAC,wCAAD,EAA2C,YAAM;IAClDR,0BAA0B,CAAC,2BAAD,EAA8B,IAA9B,CAA1B,CAA8DS,cAA9D,CAA6EC,MAA7E,CAAoFC,KAApF,CAA0F,YAA1F;IACAC,MAAM,CAACZ,0BAA0B,CAAC,GAAD,EAAM,IAAN,CAA3B,CAAN,CAA8Ca,EAA9C,CAAiDC,EAAjD,CAAoDC,SAApD;EACA,CAHC,CAAF;EAKAP,EAAE,CAAC,2BAAD,EAA8B,YAAM;IACrCI,MAAM,CAACZ,0BAA0B,CAAC,EAAD,CAA3B,CAAN,CAAuCa,EAAvC,CAA0CC,EAA1C,CAA6CC,SAA7C;EACA,CAFC,CAAF;EAIAP,EAAE,CAAC,gEAAD,EAAmE,YAAM;IAC1ER,0BAA0B,CAAC,4BAAD,EAA+B,IAA/B,CAA1B,CAA+DS,cAA/D,CAA8EC,MAA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3B,CAAkCC,KAAlC,CAAwC,WAAxC;EACA,CANC,CAAF;AAOA,CArEO,CAAR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchNumbers.test.js","names":["describe","it","expectedNumbers","country","phone","startsAt","endsAt","searchNumbers","metadata","number","should","deep","equal","shift","length"],"sources":["../source/searchNumbers.test.js"],"sourcesContent":["import searchNumbers from './searchNumbers.js'\r\nimport metadata from '../metadata.min.json'\r\n\r\ndescribe('searchNumbers', () => {\r\n\tit('should iterate', () => {\r\n\t\tconst expectedNumbers =[{\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\t// number : '+7 (800) 555-35-35',\r\n\t\t\tstartsAt : 14,\r\n\t\t\tendsAt : 32\r\n\t\t}, {\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2133734253',\r\n\t\t\t// number : '(213) 373-4253',\r\n\t\t\tstartsAt : 41,\r\n\t\t\tendsAt : 55\r\n\t\t}]\r\n\r\n\t\tfor (const number of searchNumbers('The number is +7 (800) 555-35-35 and not (213) 373-4253 as written in the document.', 'US', metadata)) {\r\n\t\t\tnumber.should.deep.equal(expectedNumbers.shift())\r\n\t\t}\r\n\r\n\t\texpectedNumbers.length.should.equal(0)\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;;;;;;;AAEAA,QAAQ,CAAC,eAAD,EAAkB,YAAM;EAC/BC,EAAE,CAAC,gBAAD,EAAmB,YAAM;IAC1B,IAAMC,eAAe,GAAE,CAAC;MACvBC,OAAO,EAAG,IADa;MAEvBC,KAAK,EAAK,YAFa;MAGvB;MACAC,QAAQ,EAAG,EAJY;MAKvBC,MAAM,EAAK;IALY,CAAD,EAMpB;MACFH,OAAO,EAAG,IADR;MAEFC,KAAK,EAAK,YAFR;MAGF;MACAC,QAAQ,EAAG,EAJT;MAKFC,MAAM,EAAK;IALT,CANoB,CAAvB;;IAcA,qDAAqB,IAAAC,yBAAA,EAAc,qFAAd,EAAqG,IAArG,EAA2GC,uBAA3G,CAArB,wCAA2I;MAAA,IAAhIC,MAAgI;MAC1IA,MAAM,CAACC,MAAP,CAAcC,IAAd,CAAmBC,KAAnB,CAAyBV,eAAe,CAACW,KAAhB,EAAzB;IACA;;IAEDX,eAAe,CAACY,MAAhB,CAAuBJ,MAAvB,CAA8BE,KAA9B,CAAoC,CAApC;EACA,CApBC,CAAF;AAqBA,CAtBO,CAAR"}
|
|
1
|
+
{"version":3,"file":"searchNumbers.test.js","names":["describe","it","expectedNumbers","country","phone","startsAt","endsAt","searchNumbers","metadata","number","should","deep","equal","shift","length"],"sources":["../source/searchNumbers.test.js"],"sourcesContent":["import searchNumbers from './searchNumbers.js'\r\nimport metadata from '../metadata.min.json' assert { type: 'json' }\r\n\r\ndescribe('searchNumbers', () => {\r\n\tit('should iterate', () => {\r\n\t\tconst expectedNumbers =[{\r\n\t\t\tcountry : 'RU',\r\n\t\t\tphone : '8005553535',\r\n\t\t\t// number : '+7 (800) 555-35-35',\r\n\t\t\tstartsAt : 14,\r\n\t\t\tendsAt : 32\r\n\t\t}, {\r\n\t\t\tcountry : 'US',\r\n\t\t\tphone : '2133734253',\r\n\t\t\t// number : '(213) 373-4253',\r\n\t\t\tstartsAt : 41,\r\n\t\t\tendsAt : 55\r\n\t\t}]\r\n\r\n\t\tfor (const number of searchNumbers('The number is +7 (800) 555-35-35 and not (213) 373-4253 as written in the document.', 'US', metadata)) {\r\n\t\t\tnumber.should.deep.equal(expectedNumbers.shift())\r\n\t\t}\r\n\r\n\t\texpectedNumbers.length.should.equal(0)\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;;;;;;;AAEAA,QAAQ,CAAC,eAAD,EAAkB,YAAM;EAC/BC,EAAE,CAAC,gBAAD,EAAmB,YAAM;IAC1B,IAAMC,eAAe,GAAE,CAAC;MACvBC,OAAO,EAAG,IADa;MAEvBC,KAAK,EAAK,YAFa;MAGvB;MACAC,QAAQ,EAAG,EAJY;MAKvBC,MAAM,EAAK;IALY,CAAD,EAMpB;MACFH,OAAO,EAAG,IADR;MAEFC,KAAK,EAAK,YAFR;MAGF;MACAC,QAAQ,EAAG,EAJT;MAKFC,MAAM,EAAK;IALT,CANoB,CAAvB;;IAcA,qDAAqB,IAAAC,yBAAA,EAAc,qFAAd,EAAqG,IAArG,EAA2GC,uBAA3G,CAArB,wCAA2I;MAAA,IAAhIC,MAAgI;MAC1IA,MAAM,CAACC,MAAP,CAAcC,IAAd,CAAmBC,KAAnB,CAAyBV,eAAe,CAACW,KAAhB,EAAzB;IACA;;IAEDX,eAAe,CAACY,MAAhB,CAAuBJ,MAAvB,CAA8BE,KAA9B,CAAoC,CAApC;EACA,CApBC,CAAF;AAqBA,CAtBO,CAAR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchPhoneNumbersInText.test.js","names":["describe","it","NUMBERS","searchPhoneNumbersInText","metadata","number","should","equal","shift"],"sources":["../source/searchPhoneNumbersInText.test.js"],"sourcesContent":["import searchPhoneNumbersInText from './searchPhoneNumbersInText.js'\r\nimport metadata from '../metadata.min.json'\r\n\r\ndescribe('searchPhoneNumbersInText', () => {\r\n\tit('should find phone numbers (with default country)', () => {\r\n\t\tconst NUMBERS = ['+78005553535', '+12133734253']\r\n\t\tfor (const number of searchPhoneNumbersInText('The number is +7 (800) 555-35-35 and not (213) 373-4253 as written in the document.', 'US', metadata)) {\r\n\t\t\tnumber.number.number.should.equal(NUMBERS[0])\r\n\t\t\tNUMBERS.shift()\r\n\t\t}\r\n\t})\r\n\r\n\tit('should find phone numbers', () => {\r\n\t\tconst NUMBERS = ['+78005553535', '+12133734253']\r\n\t\tfor (const number of searchPhoneNumbersInText('The number is +7 (800) 555-35-35 and not (213) 373-4253 as written in the document.', metadata)) {\r\n\t\t\tnumber.number.number.should.equal(NUMBERS[0])\r\n\t\t\tNUMBERS.shift()\r\n\t\t}\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;;;;;;;AAEAA,QAAQ,CAAC,0BAAD,EAA6B,YAAM;EAC1CC,EAAE,CAAC,kDAAD,EAAqD,YAAM;IAC5D,IAAMC,OAAO,GAAG,CAAC,cAAD,EAAiB,cAAjB,CAAhB;;IACA,qDAAqB,IAAAC,oCAAA,EAAyB,qFAAzB,EAAgH,IAAhH,EAAsHC,uBAAtH,CAArB,wCAAsJ;MAAA,IAA3IC,MAA2I;MACrJA,MAAM,CAACA,MAAP,CAAcA,MAAd,CAAqBC,MAArB,CAA4BC,KAA5B,CAAkCL,OAAO,CAAC,CAAD,CAAzC;MACAA,OAAO,CAACM,KAAR;IACA;EACD,CANC,CAAF;EAQAP,EAAE,CAAC,2BAAD,EAA8B,YAAM;IACrC,IAAMC,OAAO,GAAG,CAAC,cAAD,EAAiB,cAAjB,CAAhB;;IACA,sDAAqB,IAAAC,oCAAA,EAAyB,qFAAzB,EAAgHC,uBAAhH,CAArB,2CAAgJ;MAAA,IAArIC,MAAqI;MAC/IA,MAAM,CAACA,MAAP,CAAcA,MAAd,CAAqBC,MAArB,CAA4BC,KAA5B,CAAkCL,OAAO,CAAC,CAAD,CAAzC;MACAA,OAAO,CAACM,KAAR;IACA;EACD,CANC,CAAF;AAOA,CAhBO,CAAR"}
|
|
1
|
+
{"version":3,"file":"searchPhoneNumbersInText.test.js","names":["describe","it","NUMBERS","searchPhoneNumbersInText","metadata","number","should","equal","shift"],"sources":["../source/searchPhoneNumbersInText.test.js"],"sourcesContent":["import searchPhoneNumbersInText from './searchPhoneNumbersInText.js'\r\nimport metadata from '../metadata.min.json' assert { type: 'json' }\r\n\r\ndescribe('searchPhoneNumbersInText', () => {\r\n\tit('should find phone numbers (with default country)', () => {\r\n\t\tconst NUMBERS = ['+78005553535', '+12133734253']\r\n\t\tfor (const number of searchPhoneNumbersInText('The number is +7 (800) 555-35-35 and not (213) 373-4253 as written in the document.', 'US', metadata)) {\r\n\t\t\tnumber.number.number.should.equal(NUMBERS[0])\r\n\t\t\tNUMBERS.shift()\r\n\t\t}\r\n\t})\r\n\r\n\tit('should find phone numbers', () => {\r\n\t\tconst NUMBERS = ['+78005553535', '+12133734253']\r\n\t\tfor (const number of searchPhoneNumbersInText('The number is +7 (800) 555-35-35 and not (213) 373-4253 as written in the document.', metadata)) {\r\n\t\t\tnumber.number.number.should.equal(NUMBERS[0])\r\n\t\t\tNUMBERS.shift()\r\n\t\t}\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;;;;;;;AAEAA,QAAQ,CAAC,0BAAD,EAA6B,YAAM;EAC1CC,EAAE,CAAC,kDAAD,EAAqD,YAAM;IAC5D,IAAMC,OAAO,GAAG,CAAC,cAAD,EAAiB,cAAjB,CAAhB;;IACA,qDAAqB,IAAAC,oCAAA,EAAyB,qFAAzB,EAAgH,IAAhH,EAAsHC,uBAAtH,CAArB,wCAAsJ;MAAA,IAA3IC,MAA2I;MACrJA,MAAM,CAACA,MAAP,CAAcA,MAAd,CAAqBC,MAArB,CAA4BC,KAA5B,CAAkCL,OAAO,CAAC,CAAD,CAAzC;MACAA,OAAO,CAACM,KAAR;IACA;EACD,CANC,CAAF;EAQAP,EAAE,CAAC,2BAAD,EAA8B,YAAM;IACrC,IAAMC,OAAO,GAAG,CAAC,cAAD,EAAiB,cAAjB,CAAhB;;IACA,sDAAqB,IAAAC,oCAAA,EAAyB,qFAAzB,EAAgHC,uBAAhH,CAArB,2CAAgJ;MAAA,IAArIC,MAAqI;MAC/IA,MAAM,CAACA,MAAP,CAAcA,MAAd,CAAqBC,MAArB,CAA4BC,KAA5B,CAAkCL,OAAO,CAAC,CAAD,CAAzC;MACAA,OAAO,CAACM,KAAR;IACA;EACD,CANC,CAAF;AAOA,CAhBO,CAAR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.test.js","names":["isValidNumber","parameters","push","metadata","_isValidNumber","apply","describe","it","should","equal","undefined","country","phone","countries","UZ","thrower"],"sources":["../source/validate.test.js"],"sourcesContent":["import metadata from '../metadata.min.json'\r\nimport _isValidNumber from './validate.js'\r\n\r\nfunction isValidNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _isValidNumber.apply(this, parameters)\r\n}\r\n\r\ndescribe('validate', () => {\r\n\tit('should validate phone numbers', () => {\r\n\t\tisValidNumber('+1-213-373-4253').should.equal(true)\r\n\t\tisValidNumber('+1-213-373').should.equal(false)\r\n\r\n\t\tisValidNumber('+1-213-373-4253', undefined).should.equal(true)\r\n\r\n\t\tisValidNumber('(213) 373-4253', 'US').should.equal(true)\r\n\t\tisValidNumber('(213) 37', 'US').should.equal(false)\r\n\r\n\t\tisValidNumber({ country: 'US', phone: '2133734253' }).should.equal(true)\r\n\r\n\t\t// No \"types\" info: should return `true`.\r\n\t\tisValidNumber('+380972423740').should.equal(true)\r\n\r\n\t\tisValidNumber('0912345678', 'TW').should.equal(true)\r\n\r\n\t\t// Moible numbers starting 07624* are Isle of Man\r\n\t\t// which has its own \"country code\" \"IM\"\r\n\t\t// which is in the \"GB\" \"country calling code\" zone.\r\n\t\t// So while this number is for \"IM\" it's still supposed to\r\n\t\t// be valid when passed \"GB\" as a default country.\r\n\t\tisValidNumber('07624369230', 'GB').should.equal(true)\r\n\t})\r\n\r\n\tit('should refine phone number validation in case extended regular expressions are set for a country', () => {\r\n\t\t// Germany general validation must pass\r\n\t\tisValidNumber('961111111', 'UZ').should.equal(true)\r\n\r\n\t\t// Different regular expressions for precise national number validation.\r\n\t\t// `types` index in compressed array is `9` for v1.\r\n\t\t// For v2 it's 10.\r\n\t\t// For v3 it's 11.\r\n\t\tmetadata.countries.UZ[11] =\r\n\t\t[\r\n\t\t\t[\"(?:6(?:1(?:22|3[124]|4[1-4]|5[123578]|64)|2(?:22|3[0-57-9]|41)|5(?:22|3[3-7]|5[024-8])|6\\\\d{2}|7(?:[23]\\\\d|7[69])|9(?:22|4[1-8]|6[135]))|7(?:0(?:5[4-9]|6[0146]|7[12456]|9[135-8])|1[12]\\\\d|2(?:22|3[1345789]|4[123579]|5[14])|3(?:2\\\\d|3[1578]|4[1-35-7]|5[1-57]|61)|4(?:2\\\\d|3[1-579]|7[1-79])|5(?:22|5[1-9]|6[1457])|6(?:22|3[12457]|4[13-8])|9(?:22|5[1-9])))\\\\d{5}\"],\r\n\t\t\t[\"6(?:1(?:2(?:98|2[01])|35[0-4]|50\\\\d|61[23]|7(?:[01][017]|4\\\\d|55|9[5-9]))|2(?:11\\\\d|2(?:[12]1|9[01379])|5(?:[126]\\\\d|3[0-4])|7\\\\d{2})|5(?:19[01]|2(?:27|9[26])|30\\\\d|59\\\\d|7\\\\d{2})|6(?:2(?:1[5-9]|2[0367]|38|41|52|60)|3[79]\\\\d|4(?:56|83)|7(?:[07]\\\\d|1[017]|3[07]|4[047]|5[057]|67|8[0178]|9[79])|9[0-3]\\\\d)|7(?:2(?:24|3[237]|4[5-9]|7[15-8])|5(?:7[12]|8[0589])|7(?:0\\\\d|[39][07])|9(?:0\\\\d|7[079]))|9(?:2(?:1[1267]|5\\\\d|3[01]|7[0-4])|5[67]\\\\d|6(?:2[0-26]|8\\\\d)|7\\\\d{2}))\\\\d{4}|7(?:0\\\\d{3}|1(?:13[01]|6(?:0[47]|1[67]|66)|71[3-69]|98\\\\d)|2(?:2(?:2[79]|95)|3(?:2[5-9]|6[0-6])|57\\\\d|7(?:0\\\\d|1[17]|2[27]|3[37]|44|5[057]|66|88))|3(?:2(?:1[0-6]|21|3[469]|7[159])|33\\\\d|5(?:0[0-4]|5[579]|9\\\\d)|7(?:[0-3579]\\\\d|4[0467]|6[67]|8[078])|9[4-6]\\\\d)|4(?:2(?:29|5[0257]|6[0-7]|7[1-57])|5(?:1[0-4]|8\\\\d|9[5-9])|7(?:0\\\\d|1[024589]|2[0127]|3[0137]|[46][07]|5[01]|7[5-9]|9[079])|9(?:7[015-9]|[89]\\\\d))|5(?:112|2(?:0\\\\d|2[29]|[49]4)|3[1568]\\\\d|52[6-9]|7(?:0[01578]|1[017]|[23]7|4[047]|[5-7]\\\\d|8[78]|9[079]))|6(?:2(?:2[1245]|4[2-4])|39\\\\d|41[179]|5(?:[349]\\\\d|5[0-2])|7(?:0[017]|[13]\\\\d|22|44|55|67|88))|9(?:22[128]|3(?:2[0-4]|7\\\\d)|57[05629]|7(?:2[05-9]|3[37]|4\\\\d|60|7[2579]|87|9[07])))\\\\d{4}|9[0-57-9]\\\\d{7}\"]\r\n\t\t]\r\n\r\n\t\t// Extended validation must not pass for an invalid phone number\r\n\t\tisValidNumber('961111111', 'UZ').should.equal(false)\r\n\r\n\t\t// Extended validation must pass for a valid phone number\r\n\t\tisValidNumber('912345678', 'UZ').should.equal(true)\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\t// No metadata\r\n\t\tlet thrower = () => _isValidNumber('+78005553535')\r\n\t\tthrower.should.throw('`metadata` argument not passed')\r\n\r\n\t\t// Non-phone-number characters in a phone number\r\n\t\tisValidNumber('+499821958a').should.equal(false)\r\n\t\tisValidNumber('88005553535x', 'RU').should.equal(false)\r\n\r\n\t\t// Doesn't have `types` regexps in default metadata.\r\n\t\tisValidNumber({ country: 'UA', phone: '300000000' }).should.equal(true)\r\n\t\tisValidNumber({ country: 'UA', phone: '200000000' }).should.equal(false)\r\n\r\n\t\t// Numerical `value`\r\n\t\tthrower = () => isValidNumber(88005553535, 'RU')\r\n\t\tthrower.should.throw('A phone number must either be a string or an object of shape { phone, [country] }.')\r\n\r\n\t\t// Long country phone code\r\n\t\tisValidNumber('+3725555555').should.equal(true)\r\n\r\n\t\t// Invalid country\r\n\t\tthrower = () => isValidNumber({ phone: '8005553535', country: 'RUS' })\r\n\t\tthrower.should.throw('Unknown country')\r\n\t})\r\n\r\n\tit('should accept phone number extensions', () => {\r\n\t\t// International\r\n\t\tisValidNumber('+12133734253 ext. 123').should.equal(true)\r\n\t\t// National\r\n\t\tisValidNumber('88005553535 x123', 'RU').should.equal(true)\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEA,SAASA,aAAT,GAAsC;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAA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C;;IACAM,OAAO,GAAG;MAAA,OAAMf,aAAa,CAAC;QAAEY,KAAK,EAAE,YAAT;QAAuBD,OAAO,EAAE;MAAhC,CAAD,CAAnB;IAAA,CAAV;;IACAI,OAAO,CAACP,MAAR,UAAqB,iBAArB;EACA,CAvBC,CAAF;EAyBAD,EAAE,CAAC,uCAAD,EAA0C,YAAM;IACjD;IACAP,aAAa,CAAC,uBAAD,CAAb,CAAuCQ,MAAvC,CAA8CC,KAA9C,CAAoD,IAApD,EAFiD,CAGjD;;IACAT,aAAa,CAAC,kBAAD,EAAqB,IAArB,CAAb,CAAwCQ,MAAxC,CAA+CC,KAA/C,CAAqD,IAArD;EACA,CALC,CAAF;AAMA,CA7EO,CAAR"}
|
|
1
|
+
{"version":3,"file":"validate.test.js","names":["isValidNumber","parameters","push","metadata","_isValidNumber","apply","describe","it","should","equal","undefined","country","phone","countries","UZ","thrower"],"sources":["../source/validate.test.js"],"sourcesContent":["import metadata from '../metadata.min.json' assert { type: 'json' }\r\nimport _isValidNumber from './validate.js'\r\n\r\nfunction isValidNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _isValidNumber.apply(this, parameters)\r\n}\r\n\r\ndescribe('validate', () => {\r\n\tit('should validate phone numbers', () => {\r\n\t\tisValidNumber('+1-213-373-4253').should.equal(true)\r\n\t\tisValidNumber('+1-213-373').should.equal(false)\r\n\r\n\t\tisValidNumber('+1-213-373-4253', undefined).should.equal(true)\r\n\r\n\t\tisValidNumber('(213) 373-4253', 'US').should.equal(true)\r\n\t\tisValidNumber('(213) 37', 'US').should.equal(false)\r\n\r\n\t\tisValidNumber({ country: 'US', phone: '2133734253' }).should.equal(true)\r\n\r\n\t\t// No \"types\" info: should return `true`.\r\n\t\tisValidNumber('+380972423740').should.equal(true)\r\n\r\n\t\tisValidNumber('0912345678', 'TW').should.equal(true)\r\n\r\n\t\t// Moible numbers starting 07624* are Isle of Man\r\n\t\t// which has its own \"country code\" \"IM\"\r\n\t\t// which is in the \"GB\" \"country calling code\" zone.\r\n\t\t// So while this number is for \"IM\" it's still supposed to\r\n\t\t// be valid when passed \"GB\" as a default country.\r\n\t\tisValidNumber('07624369230', 'GB').should.equal(true)\r\n\t})\r\n\r\n\tit('should refine phone number validation in case extended regular expressions are set for a country', () => {\r\n\t\t// Germany general validation must pass\r\n\t\tisValidNumber('961111111', 'UZ').should.equal(true)\r\n\r\n\t\t// Different regular expressions for precise national number validation.\r\n\t\t// `types` index in compressed array is `9` for v1.\r\n\t\t// For v2 it's 10.\r\n\t\t// For v3 it's 11.\r\n\t\tmetadata.countries.UZ[11] =\r\n\t\t[\r\n\t\t\t[\"(?:6(?:1(?:22|3[124]|4[1-4]|5[123578]|64)|2(?:22|3[0-57-9]|41)|5(?:22|3[3-7]|5[024-8])|6\\\\d{2}|7(?:[23]\\\\d|7[69])|9(?:22|4[1-8]|6[135]))|7(?:0(?:5[4-9]|6[0146]|7[12456]|9[135-8])|1[12]\\\\d|2(?:22|3[1345789]|4[123579]|5[14])|3(?:2\\\\d|3[1578]|4[1-35-7]|5[1-57]|61)|4(?:2\\\\d|3[1-579]|7[1-79])|5(?:22|5[1-9]|6[1457])|6(?:22|3[12457]|4[13-8])|9(?:22|5[1-9])))\\\\d{5}\"],\r\n\t\t\t[\"6(?:1(?:2(?:98|2[01])|35[0-4]|50\\\\d|61[23]|7(?:[01][017]|4\\\\d|55|9[5-9]))|2(?:11\\\\d|2(?:[12]1|9[01379])|5(?:[126]\\\\d|3[0-4])|7\\\\d{2})|5(?:19[01]|2(?:27|9[26])|30\\\\d|59\\\\d|7\\\\d{2})|6(?:2(?:1[5-9]|2[0367]|38|41|52|60)|3[79]\\\\d|4(?:56|83)|7(?:[07]\\\\d|1[017]|3[07]|4[047]|5[057]|67|8[0178]|9[79])|9[0-3]\\\\d)|7(?:2(?:24|3[237]|4[5-9]|7[15-8])|5(?:7[12]|8[0589])|7(?:0\\\\d|[39][07])|9(?:0\\\\d|7[079]))|9(?:2(?:1[1267]|5\\\\d|3[01]|7[0-4])|5[67]\\\\d|6(?:2[0-26]|8\\\\d)|7\\\\d{2}))\\\\d{4}|7(?:0\\\\d{3}|1(?:13[01]|6(?:0[47]|1[67]|66)|71[3-69]|98\\\\d)|2(?:2(?:2[79]|95)|3(?:2[5-9]|6[0-6])|57\\\\d|7(?:0\\\\d|1[17]|2[27]|3[37]|44|5[057]|66|88))|3(?:2(?:1[0-6]|21|3[469]|7[159])|33\\\\d|5(?:0[0-4]|5[579]|9\\\\d)|7(?:[0-3579]\\\\d|4[0467]|6[67]|8[078])|9[4-6]\\\\d)|4(?:2(?:29|5[0257]|6[0-7]|7[1-57])|5(?:1[0-4]|8\\\\d|9[5-9])|7(?:0\\\\d|1[024589]|2[0127]|3[0137]|[46][07]|5[01]|7[5-9]|9[079])|9(?:7[015-9]|[89]\\\\d))|5(?:112|2(?:0\\\\d|2[29]|[49]4)|3[1568]\\\\d|52[6-9]|7(?:0[01578]|1[017]|[23]7|4[047]|[5-7]\\\\d|8[78]|9[079]))|6(?:2(?:2[1245]|4[2-4])|39\\\\d|41[179]|5(?:[349]\\\\d|5[0-2])|7(?:0[017]|[13]\\\\d|22|44|55|67|88))|9(?:22[128]|3(?:2[0-4]|7\\\\d)|57[05629]|7(?:2[05-9]|3[37]|4\\\\d|60|7[2579]|87|9[07])))\\\\d{4}|9[0-57-9]\\\\d{7}\"]\r\n\t\t]\r\n\r\n\t\t// Extended validation must not pass for an invalid phone number\r\n\t\tisValidNumber('961111111', 'UZ').should.equal(false)\r\n\r\n\t\t// Extended validation must pass for a valid phone number\r\n\t\tisValidNumber('912345678', 'UZ').should.equal(true)\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\t// No metadata\r\n\t\tlet thrower = () => _isValidNumber('+78005553535')\r\n\t\tthrower.should.throw('`metadata` argument not passed')\r\n\r\n\t\t// Non-phone-number characters in a phone number\r\n\t\tisValidNumber('+499821958a').should.equal(false)\r\n\t\tisValidNumber('88005553535x', 'RU').should.equal(false)\r\n\r\n\t\t// Doesn't have `types` regexps in default metadata.\r\n\t\tisValidNumber({ country: 'UA', phone: '300000000' }).should.equal(true)\r\n\t\tisValidNumber({ country: 'UA', phone: '200000000' }).should.equal(false)\r\n\r\n\t\t// Numerical `value`\r\n\t\tthrower = () => isValidNumber(88005553535, 'RU')\r\n\t\tthrower.should.throw('A phone number must either be a string or an object of shape { phone, [country] }.')\r\n\r\n\t\t// Long country phone code\r\n\t\tisValidNumber('+3725555555').should.equal(true)\r\n\r\n\t\t// Invalid country\r\n\t\tthrower = () => isValidNumber({ phone: '8005553535', country: 'RUS' })\r\n\t\tthrower.should.throw('Unknown country')\r\n\t})\r\n\r\n\tit('should accept phone number extensions', () => {\r\n\t\t// International\r\n\t\tisValidNumber('+12133734253 ext. 123').should.equal(true)\r\n\t\t// National\r\n\t\tisValidNumber('88005553535 x123', 'RU').should.equal(true)\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEA,SAASA,aAAT,GAAsC;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EACrCA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,oBAAA,CAAeC,KAAf,CAAqB,IAArB,EAA2BJ,UAA3B,CAAP;AACA;;AAEDK,QAAQ,CAAC,UAAD,EAAa,YAAM;EAC1BC,EAAE,CAAC,+BAAD,EAAkC,YAAM;IACzCP,aAAa,CAAC,iBAAD,CAAb,CAAiCQ,MAAjC,CAAwCC,KAAxC,CAA8C,IAA9C;IACAT,aAAa,CAAC,YAAD,CAAb,CAA4BQ,MAA5B,CAAmCC,KAAnC,CAAyC,KAAzC;IAEAT,aAAa,CAAC,iBAAD,EAAoBU,SAApB,CAAb,CAA4CF,MAA5C,CAAmDC,KAAnD,CAAyD,IAAzD;IAEAT,aAAa,CAAC,gBAAD,EAAmB,IAAnB,CAAb,CAAsCQ,MAAtC,CAA6CC,KAA7C,CAAmD,IAAnD;IACAT,aAAa,CAAC,UAAD,EAAa,IAAb,CAAb,CAAg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,MAA7B,CAAoCC,KAApC,CAA0C,KAA1C;IACAT,aAAa,CAAC,cAAD,EAAiB,IAAjB,CAAb,CAAoCQ,MAApC,CAA2CC,KAA3C,CAAiD,KAAjD,EAPqC,CASrC;;IACAT,aAAa,CAAC;MAAEW,OAAO,EAAE,IAAX;MAAiBC,KAAK,EAAE;IAAxB,CAAD,CAAb,CAAqDJ,MAArD,CAA4DC,KAA5D,CAAkE,IAAlE;IACAT,aAAa,CAAC;MAAEW,OAAO,EAAE,IAAX;MAAiBC,KAAK,EAAE;IAAxB,CAAD,CAAb,CAAqDJ,MAArD,CAA4DC,KAA5D,CAAkE,KAAlE,EAXqC,CAarC;;IACAM,OAAO,GAAG;MAAA,OAAMf,aAAa,CAAC,WAAD,EAAc,IAAd,CAAnB;IAAA,CAAV;;IACAe,OAAO,CAACP,MAAR,UAAqB,oFAArB,EAfqC,CAiBrC;;IACAR,aAAa,CAAC,aAAD,CAAb,CAA6BQ,MAA7B,CAAoCC,KAApC,CAA0C,IAA1C,EAlBqC,CAoBrC;;IACAM,OAAO,GAAG;MAAA,OAAMf,aAAa,CAAC;QAAEY,KAAK,EAAE,YAAT;QAAuBD,OAAO,EAAE;MAAhC,CAAD,CAAnB;IAAA,CAAV;;IACAI,OAAO,CAACP,MAAR,UAAqB,iBAArB;EACA,CAvBC,CAAF;EAyBAD,EAAE,CAAC,uCAAD,EAA0C,YAAM;IACjD;IACAP,aAAa,CAAC,uBAAD,CAAb,CAAuCQ,MAAvC,CAA8CC,KAA9C,CAAoD,IAApD,EAFiD,CAGjD;;IACAT,aAAa,CAAC,kBAAD,EAAqB,IAArB,CAAb,CAAwCQ,MAAxC,CAA+CC,KAA/C,CAAqD,IAArD;EACA,CALC,CAAF;AAMA,CA7EO,CAAR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validatePhoneNumberLength.test.js","names":["validatePhoneNumberLength","parameters","push","metadata","_validatePhoneNumberLength","apply","describe","it","should","equal","expect","to","be","undefined"],"sources":["../source/validatePhoneNumberLength.test.js"],"sourcesContent":["import _validatePhoneNumberLength from './validatePhoneNumberLength.js'\r\nimport metadata from '../metadata.min.json'\r\n\r\nfunction validatePhoneNumberLength(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _validatePhoneNumberLength.apply(this, parameters)\r\n}\r\n\r\ndescribe('validatePhoneNumberLength', () => {\r\n\tit('should detect whether a phone number length is valid', () => {\r\n\t\t// Not a phone number.\r\n\t\tvalidatePhoneNumberLength('+').should.equal('NOT_A_NUMBER')\r\n\t\tvalidatePhoneNumberLength('abcde').should.equal('NOT_A_NUMBER')\r\n\r\n\t\t// No country supplied for a national number.\r\n\t\tvalidatePhoneNumberLength('123').should.equal('INVALID_COUNTRY')\r\n\r\n\t\t// Too short while the number is not considered \"viable\"\r\n\t\t// by Google's `libphonenumber`.\r\n\t\tvalidatePhoneNumberLength('2', 'US').should.equal('TOO_SHORT')\r\n\t\tvalidatePhoneNumberLength('+1', 'US').should.equal('TOO_SHORT')\r\n\t\tvalidatePhoneNumberLength('+12', 'US').should.equal('TOO_SHORT')\r\n\r\n\t\t// Test national (significant) number length.\r\n\t\tvalidatePhoneNumberLength('444 1 44', 'TR').should.equal('TOO_SHORT')\r\n\t\texpect(validatePhoneNumberLength('444 1 444', 'TR')).to.be.undefined\r\n\t\tvalidatePhoneNumberLength('444 1 4444', 'TR').should.equal('INVALID_LENGTH')\r\n\t\tvalidatePhoneNumberLength('444 1 4444444444', 'TR').should.equal('TOO_LONG')\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEA,SAASA,yBAAT,GAAkD;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EACjDA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,sCAAA,CAA2BC,KAA3B,CAAiC,IAAjC,EAAuCJ,UAAvC,CAAP;AACA;;AAEDK,QAAQ,CAAC,2BAAD,EAA8B,YAAM;EAC3CC,EAAE,CAAC,sDAAD,EAAyD,YAAM;IAChE;IACAP,yBAAyB,CAAC,GAAD,CAAzB,CAA+BQ,MAA/B,CAAsCC,KAAtC,CAA4C,cAA5C;IACAT,yBAAyB,CAAC,OAAD,CAAzB,CAAmCQ,MAAnC,CAA0CC,KAA1C,CAAgD,cAAhD,EAHgE,CAKhE;;IACAT,yBAAyB,CAAC,KAAD,CAAzB,CAAiCQ,MAAjC,CAAwCC,KAAxC,CAA8C,iBAA9C,EANgE,CAQhE;IACA;;IACAT,yBAAyB,CAAC,GAAD,EAAM,IAAN,CAAzB,CAAqCQ,MAArC,CAA4CC,KAA5C,CAAkD,WAAlD;IACAT,yBAAyB,CAAC,IAAD,EAAO,IAAP,CAAzB,CAAsCQ,MAAtC,CAA6CC,KAA7C,CAAmD,WAAnD;IACAT,yBAAyB,CAAC,KAAD,EAAQ,IAAR,CAAzB,CAAuCQ,MAAvC,CAA8CC,KAA9C,CAAoD,WAApD,EAZgE,CAchE;;IACAT,yBAAyB,CAAC,UAAD,EAAa,IAAb,CAAzB,CAA4CQ,MAA5C,CAAmDC,KAAnD,CAAyD,WAAzD;IACAC,MAAM,CAACV,yBAAyB,CAAC,WAAD,EAAc,IAAd,CAA1B,CAAN,CAAqDW,EAArD,CAAwDC,EAAxD,CAA2DC,SAA3D;IACAb,yBAAyB,CAAC,YAAD,EAAe,IAAf,CAAzB,CAA8CQ,MAA9C,CAAqDC,KAArD,CAA2D,gBAA3D;IACAT,yBAAyB,CAAC,kBAAD,EAAqB,IAArB,CAAzB,CAAoDQ,MAApD,CAA2DC,KAA3D,CAAiE,UAAjE;EACA,CAnBC,CAAF;AAoBA,CArBO,CAAR"}
|
|
1
|
+
{"version":3,"file":"validatePhoneNumberLength.test.js","names":["validatePhoneNumberLength","parameters","push","metadata","_validatePhoneNumberLength","apply","describe","it","should","equal","expect","to","be","undefined"],"sources":["../source/validatePhoneNumberLength.test.js"],"sourcesContent":["import _validatePhoneNumberLength from './validatePhoneNumberLength.js'\r\nimport metadata from '../metadata.min.json' assert { type: 'json' }\r\n\r\nfunction validatePhoneNumberLength(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _validatePhoneNumberLength.apply(this, parameters)\r\n}\r\n\r\ndescribe('validatePhoneNumberLength', () => {\r\n\tit('should detect whether a phone number length is valid', () => {\r\n\t\t// Not a phone number.\r\n\t\tvalidatePhoneNumberLength('+').should.equal('NOT_A_NUMBER')\r\n\t\tvalidatePhoneNumberLength('abcde').should.equal('NOT_A_NUMBER')\r\n\r\n\t\t// No country supplied for a national number.\r\n\t\tvalidatePhoneNumberLength('123').should.equal('INVALID_COUNTRY')\r\n\r\n\t\t// Too short while the number is not considered \"viable\"\r\n\t\t// by Google's `libphonenumber`.\r\n\t\tvalidatePhoneNumberLength('2', 'US').should.equal('TOO_SHORT')\r\n\t\tvalidatePhoneNumberLength('+1', 'US').should.equal('TOO_SHORT')\r\n\t\tvalidatePhoneNumberLength('+12', 'US').should.equal('TOO_SHORT')\r\n\r\n\t\t// Test national (significant) number length.\r\n\t\tvalidatePhoneNumberLength('444 1 44', 'TR').should.equal('TOO_SHORT')\r\n\t\texpect(validatePhoneNumberLength('444 1 444', 'TR')).to.be.undefined\r\n\t\tvalidatePhoneNumberLength('444 1 4444', 'TR').should.equal('INVALID_LENGTH')\r\n\t\tvalidatePhoneNumberLength('444 1 4444444444', 'TR').should.equal('TOO_LONG')\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEA,SAASA,yBAAT,GAAkD;EAAA,kCAAZC,UAAY;IAAZA,UAAY;EAAA;;EACjDA,UAAU,CAACC,IAAX,CAAgBC,uBAAhB;EACA,OAAOC,sCAAA,CAA2BC,KAA3B,CAAiC,IAAjC,EAAuCJ,UAAvC,CAAP;AACA;;AAEDK,QAAQ,CAAC,2BAAD,EAA8B,YAAM;EAC3CC,EAAE,CAAC,sDAAD,EAAyD,YAAM;IAChE;IACAP,yBAAyB,CAAC,GAAD,CAAzB,CAA+BQ,MAA/B,CAAsCC,KAAtC,CAA4C,cAA5C;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