pixel-react 1.14.87 → 1.14.89
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/README.md +75 -75
- package/lib/_virtual/index10.js +2 -2
- package/lib/_virtual/index11.js +2 -2
- package/lib/_virtual/index12.js +2 -2
- package/lib/_virtual/index9.js +2 -2
- package/lib/assets/icons/dataset_list.svg.js +1 -1
- package/lib/assets/icons/dataset_list.svg.js.map +1 -1
- package/lib/assets/icons/spinner.svg.js +1 -1
- package/lib/assets/icons/spinner.svg.js.map +1 -1
- package/lib/components/Chip/Chip.js +1 -1
- package/lib/components/Chip/Chip.js.map +1 -1
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.js +9 -0
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.js.map +1 -1
- package/lib/components/Select/Select.js +3 -2
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/index.cjs +1362 -6766
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/node_modules/js-beautify/js/src/css/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/css/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/css/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/tokenizer.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/tokenizer.js +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouType.js +6 -8
- package/lib/node_modules/libphonenumber-js/es6/AsYouType.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +4 -4
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js +4 -4
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeParser.js +41 -28
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeParser.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeState.js +21 -17
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeState.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/PhoneNumber.js +1 -1
- package/lib/node_modules/libphonenumber-js/es6/PhoneNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/format.js +50 -91
- package/lib/node_modules/libphonenumber-js/es6/format.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +39 -6
- package/lib/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +13 -10
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +10 -8
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +15 -5
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +2 -2
- package/lib/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +30 -8
- package/lib/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +4 -4
- package/lib/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/isPossible.js +4 -4
- package/lib/node_modules/libphonenumber-js/es6/isPossible.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/metadata.js +1 -1
- package/lib/node_modules/libphonenumber-js/es6/metadata.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/parse.js +9 -7
- package/lib/node_modules/libphonenumber-js/es6/parse.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +7 -7
- package/lib/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/metadata.min.json.js +11 -11
- package/lib/node_modules/libphonenumber-js/metadata.min.json.js.map +1 -1
- package/lib/node_modules/prop-types/index.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/DayPicker.js +33 -21
- package/lib/node_modules/react-day-picker/dist/esm/DayPicker.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/classes/DateLib.js +41 -0
- package/lib/node_modules/react-day-picker/dist/esm/classes/DateLib.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +3 -2
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +3 -2
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelGrid.js.map +1 -1
- package/lib/node_modules/react-hook-form/dist/index.esm.js +60 -38
- package/lib/node_modules/react-hook-form/dist/index.esm.js.map +1 -1
- package/lib/node_modules/react-virtuoso/dist/index.js +397 -397
- package/lib/node_modules/react-virtuoso/dist/index.js.map +1 -1
- package/lib/node_modules/ua-parser-js/src/ua-parser.js +85 -71
- package/lib/node_modules/ua-parser-js/src/ua-parser.js.map +1 -1
- package/lib/styles.css +1 -1
- package/lib/styles.css.map +1 -1
- package/lib/utils/getEncryptedData/getEncryptedData.d.ts +1 -1
- package/lib/utils/getEncryptedData/getEncryptedData.js +17 -8
- package/lib/utils/getEncryptedData/getEncryptedData.js.map +1 -1
- package/package.json +106 -107
- package/lib/node_modules/jsencrypt/lib/JSEncrypt.js +0 -246
- package/lib/node_modules/jsencrypt/lib/JSEncrypt.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/JSEncryptRSAKey.js +0 -325
- package/lib/node_modules/jsencrypt/lib/JSEncryptRSAKey.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/index.js +0 -6
- package/lib/node_modules/jsencrypt/lib/index.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/asn1.js +0 -570
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/asn1.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/base64.js +0 -88
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/base64.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/hex.js +0 -66
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/hex.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/int10.js +0 -87
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/int10.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/base64.js +0 -65
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/base64.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/jsbn.js +0 -1700
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/jsbn.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/prng4.js +0 -48
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/prng4.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/rng.js +0 -77
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/rng.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/rsa.js +0 -415
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/rsa.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/sha256.js +0 -307
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/sha256.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/util.js +0 -61
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/util.js.map +0 -1
- package/lib/node_modules/jsencrypt/lib/lib/jsrsasign/asn1-1.0.js +0 -1559
- package/lib/node_modules/jsencrypt/lib/lib/jsrsasign/asn1-1.0.js.map +0 -1
@@ -10,18 +10,19 @@ import { MAX_LENGTH_COUNTRY_CODE } from '../constants.js';
|
|
10
10
|
* a national prefix, carrier code, and national
|
11
11
|
* (significant) number.
|
12
12
|
* @param {string} number — Phone number digits (possibly with a `+`).
|
13
|
-
* @param {string} [country] —
|
14
|
-
* @param {string} [
|
13
|
+
* @param {string} [country] — Country.
|
14
|
+
* @param {string} [defaultCountry] — Default country.
|
15
|
+
* @param {string} [defaultCallingCode] — Default calling code (some phone numbering plans are non-geographic).
|
15
16
|
* @param {object} metadata
|
16
17
|
* @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }`
|
17
18
|
* @example
|
18
19
|
* // Returns `{ countryCallingCode: "1", number: "2133734253" }`.
|
19
|
-
* extractCountryCallingCode('2133734253', 'US', null, metadata)
|
20
|
-
* extractCountryCallingCode('2133734253', null, '1', metadata)
|
21
|
-
* extractCountryCallingCode('+12133734253', null, null, metadata)
|
22
|
-
* extractCountryCallingCode('+12133734253', 'RU', null, metadata)
|
20
|
+
* extractCountryCallingCode('2133734253', null, 'US', null, metadata)
|
21
|
+
* extractCountryCallingCode('2133734253', null, null, '1', metadata)
|
22
|
+
* extractCountryCallingCode('+12133734253', null, null, null, metadata)
|
23
|
+
* extractCountryCallingCode('+12133734253', null, 'RU', null, metadata)
|
23
24
|
*/
|
24
|
-
function extractCountryCallingCode(number, country,
|
25
|
+
function extractCountryCallingCode(number, country, defaultCountry, defaultCallingCode, metadata) {
|
25
26
|
if (!number) {
|
26
27
|
return {};
|
27
28
|
}
|
@@ -37,7 +38,7 @@ function extractCountryCallingCode(number, country, callingCode, metadata) {
|
|
37
38
|
if (number[0] !== '+') {
|
38
39
|
// Convert an "out-of-country" dialing phone number
|
39
40
|
// to a proper international phone number.
|
40
|
-
var numberWithoutIDD = stripIddPrefix(number, country,
|
41
|
+
var numberWithoutIDD = stripIddPrefix(number, country || defaultCountry, defaultCallingCode, metadata);
|
41
42
|
// If an IDD prefix was stripped then
|
42
43
|
// convert the number to international one
|
43
44
|
// for subsequent parsing.
|
@@ -49,8 +50,8 @@ function extractCountryCallingCode(number, country, callingCode, metadata) {
|
|
49
50
|
// for the default country. If so, we remove the country calling code,
|
50
51
|
// and do some checks on the validity of the number before and after.
|
51
52
|
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
52
|
-
if (country ||
|
53
|
-
var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country,
|
53
|
+
if (country || defaultCountry || defaultCallingCode) {
|
54
|
+
var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata),
|
54
55
|
countryCallingCode = _extractCountryCallin.countryCallingCode,
|
55
56
|
shorterNumber = _extractCountryCallin.number;
|
56
57
|
if (countryCallingCode) {
|
@@ -69,6 +70,8 @@ function extractCountryCallingCode(number, country, callingCode, metadata) {
|
|
69
70
|
}
|
70
71
|
}
|
71
72
|
|
73
|
+
// `number` can only be international at this point.
|
74
|
+
|
72
75
|
// Fast abortion: country codes do not begin with a '0'
|
73
76
|
if (number[1] === '0') {
|
74
77
|
return {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"extractCountryCallingCode.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js"],"sourcesContent":["import stripIddPrefix from './stripIddPrefix.js';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js';\nimport Metadata from '../metadata.js';\nimport { MAX_LENGTH_COUNTRY_CODE } from '../constants.js';\n\n/**\r\n * Converts a phone number digits (possibly with a `+`)\r\n * into a calling code and the rest phone number digits.\r\n * The \"rest phone number digits\" could include\r\n * a national prefix, carrier code, and national\r\n * (significant) number.\r\n * @param {string} number — Phone number digits (possibly with a `+`).\r\n * @param {string} [country] — Default country.\r\n * @param {string} [
|
1
|
+
{"version":3,"file":"extractCountryCallingCode.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js"],"sourcesContent":["import stripIddPrefix from './stripIddPrefix.js';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js';\nimport Metadata from '../metadata.js';\nimport { MAX_LENGTH_COUNTRY_CODE } from '../constants.js';\n\n/**\r\n * Converts a phone number digits (possibly with a `+`)\r\n * into a calling code and the rest phone number digits.\r\n * The \"rest phone number digits\" could include\r\n * a national prefix, carrier code, and national\r\n * (significant) number.\r\n * @param {string} number — Phone number digits (possibly with a `+`).\r\n * @param {string} [country] — Country.\r\n * @param {string} [defaultCountry] — Default country.\r\n * @param {string} [defaultCallingCode] — Default calling code (some phone numbering plans are non-geographic).\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }`\r\n * @example\r\n * // Returns `{ countryCallingCode: \"1\", number: \"2133734253\" }`.\r\n * extractCountryCallingCode('2133734253', null, 'US', null, metadata)\r\n * extractCountryCallingCode('2133734253', null, null, '1', metadata)\r\n * extractCountryCallingCode('+12133734253', null, null, null, metadata)\r\n * extractCountryCallingCode('+12133734253', null, 'RU', null, metadata)\r\n */\nexport default function extractCountryCallingCode(number, country, defaultCountry, defaultCallingCode, metadata) {\n if (!number) {\n return {};\n }\n var isNumberWithIddPrefix;\n\n // If this is not an international phone number,\n // then either extract an \"IDD\" prefix, or extract a\n // country calling code from a number by autocorrecting it\n // by prepending a leading `+` in cases when it starts\n // with the country calling code.\n // https://wikitravel.org/en/International_dialling_prefix\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (number[0] !== '+') {\n // Convert an \"out-of-country\" dialing phone number\n // to a proper international phone number.\n var numberWithoutIDD = stripIddPrefix(number, country || defaultCountry, defaultCallingCode, metadata);\n // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n if (numberWithoutIDD && numberWithoutIDD !== number) {\n isNumberWithIddPrefix = true;\n number = '+' + numberWithoutIDD;\n } else {\n // Check to see if the number starts with the country calling code\n // for the default country. If so, we remove the country calling code,\n // and do some checks on the validity of the number before and after.\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (country || defaultCountry || defaultCallingCode) {\n var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n shorterNumber = _extractCountryCallin.number;\n if (countryCallingCode) {\n return {\n countryCallingCodeSource: 'FROM_NUMBER_WITHOUT_PLUS_SIGN',\n countryCallingCode: countryCallingCode,\n number: shorterNumber\n };\n }\n }\n return {\n // No need to set it to `UNSPECIFIED`. It can be just `undefined`.\n // countryCallingCodeSource: 'UNSPECIFIED',\n number: number\n };\n }\n }\n\n // `number` can only be international at this point.\n\n // Fast abortion: country codes do not begin with a '0'\n if (number[1] === '0') {\n return {};\n }\n metadata = new Metadata(metadata);\n\n // The thing with country phone codes\n // is that they are orthogonal to each other\n // i.e. there's no such country phone code A\n // for which country phone code B exists\n // where B starts with A.\n // Therefore, while scanning digits,\n // if a valid country code is found,\n // that means that it is the country code.\n //\n var i = 2;\n while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {\n var _countryCallingCode = number.slice(1, i);\n if (metadata.hasCallingCode(_countryCallingCode)) {\n metadata.selectNumberingPlan(_countryCallingCode);\n return {\n countryCallingCodeSource: isNumberWithIddPrefix ? 'FROM_NUMBER_WITH_IDD' : 'FROM_NUMBER_WITH_PLUS_SIGN',\n countryCallingCode: _countryCallingCode,\n number: number.slice(i)\n };\n }\n i++;\n }\n return {};\n}\n\n// The possible values for the returned `countryCallingCodeSource` are:\n//\n// Copy-pasted from:\n// https://github.com/google/libphonenumber/blob/master/resources/phonenumber.proto\n//\n// // The source from which the country_code is derived. This is not set in the\n// // general parsing method, but in the method that parses and keeps raw_input.\n// // New fields could be added upon request.\n// enum CountryCodeSource {\n// // Default value returned if this is not set, because the phone number was\n// // created using parse, not parseAndKeepRawInput. hasCountryCodeSource will\n// // return false if this is the case.\n// UNSPECIFIED = 0;\n//\n// // The country_code is derived based on a phone number with a leading \"+\",\n// // e.g. the French number \"+33 1 42 68 53 00\".\n// FROM_NUMBER_WITH_PLUS_SIGN = 1;\n//\n// // The country_code is derived based on a phone number with a leading IDD,\n// // e.g. the French number \"011 33 1 42 68 53 00\", as it is dialled from US.\n// FROM_NUMBER_WITH_IDD = 5;\n//\n// // The country_code is derived based on a phone number without a leading\n// // \"+\", e.g. the French number \"33 1 42 68 53 00\" when defaultCountry is\n// // supplied as France.\n// FROM_NUMBER_WITHOUT_PLUS_SIGN = 10;\n//\n// // The country_code is derived NOT based on the phone number itself, but\n// // from the defaultCountry parameter provided in the parsing function by the\n// // clients. This happens mostly for numbers written in the national format\n// // (without country code). For example, this would be set when parsing the\n// // French number \"01 42 68 53 00\", when defaultCountry is supplied as\n// // France.\n// FROM_DEFAULT_COUNTRY = 20;\n// }\n//# sourceMappingURL=extractCountryCallingCode.js.map"],"names":["extractCountryCallingCode","number","country","defaultCountry","defaultCallingCode","metadata","isNumberWithIddPrefix","numberWithoutIDD","stripIddPrefix","_extractCountryCallin","extractCountryCallingCodeFromInternationalNumberWithoutPlusSign","countryCallingCode","shorterNumber","countryCallingCodeSource","Metadata","i","MAX_LENGTH_COUNTRY_CODE","length","_countryCallingCode","slice","hasCallingCode","selectNumberingPlan"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,yBAAyBA,CAChDC,MAAM,EACNC,OAAO,EACPC,cAAc,EACdC,kBAAkB,EAClBC,QAAQ,EACP;EACD,IAAI,CAACJ,MAAM,EAAE;AACZ,IAAA,OAAO,EAAE;AACV,EAAA;AAEA,EAAA,IAAIK,qBAAqB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,IAAIL,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AACtB;AACA;AACA,IAAA,IAAMM,gBAAgB,GAAGC,cAAc,CAACP,MAAM,EAAEC,OAAO,IAAIC,cAAc,EAAEC,kBAAkB,EAAEC,QAAQ,CAAC;AACxG;AACA;AACA;AACA,IAAA,IAAIE,gBAAgB,IAAIA,gBAAgB,KAAKN,MAAM,EAAE;AACpDK,MAAAA,qBAAqB,GAAG,IAAI;MAC5BL,MAAM,GAAG,GAAG,GAAGM,gBAAgB;AAChC,IAAA,CAAC,MAAM;AACN;AACA;AACA;AACA;AACA,MAAA,IAAIL,OAAO,IAAIC,cAAc,IAAIC,kBAAkB,EAAE;AACpD,QAAA,IAAAK,qBAAA,GAGIC,+DAA+D,CAClET,MAAM,EACNC,OAAO,EACPC,cAAc,EACdC,kBAAkB,EAClBC,QACD,CAAC;UARAM,kBAAkB,GAAAF,qBAAA,CAAlBE,kBAAkB;UACVC,aAAa,GAAAH,qBAAA,CAArBR,MAAM;AAQP,QAAA,IAAIU,kBAAkB,EAAE;UACvB,OAAO;AACNE,YAAAA,wBAAwB,EAAE,+BAA+B;AACzDF,YAAAA,kBAAkB,EAAlBA,kBAAkB;AAClBV,YAAAA,MAAM,EAAEW;WACR;AACF,QAAA;AACD,MAAA;MACA,OAAO;AACN;AACA;AACAX,QAAAA,MAAM,EAANA;OACA;AACF,IAAA;AACD,EAAA;;AAEA;;AAEA;AACA,EAAA,IAAIA,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AACtB,IAAA,OAAO,EAAE;AACV,EAAA;AAEAI,EAAAA,QAAQ,GAAG,IAAIS,QAAQ,CAACT,QAAQ,CAAC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACA,IAAIU,CAAC,GAAG,CAAC;EACT,OAAOA,CAAC,GAAG,CAAC,IAAIC,uBAAuB,IAAID,CAAC,IAAId,MAAM,CAACgB,MAAM,EAAE;IAC9D,IAAMC,mBAAkB,GAAGjB,MAAM,CAACkB,KAAK,CAAC,CAAC,EAAEJ,CAAC,CAAC;AAC7C,IAAA,IAAIV,QAAQ,CAACe,cAAc,CAACF,mBAAkB,CAAC,EAAE;AAChDb,MAAAA,QAAQ,CAACgB,mBAAmB,CAACH,mBAAkB,CAAC;MAChD,OAAO;AACNL,QAAAA,wBAAwB,EAAEP,qBAAqB,GAAG,sBAAsB,GAAG,4BAA4B;AACvGK,QAAAA,kBAAkB,EAAlBO,mBAAkB;AAClBjB,QAAAA,MAAM,EAAEA,MAAM,CAACkB,KAAK,CAACJ,CAAC;OACtB;AACF,IAAA;AACAA,IAAAA,CAAC,EAAE;AACJ,EAAA;AAEA,EAAA,OAAO,EAAE;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;","x_google_ignoreList":[0]}
|
@@ -7,21 +7,23 @@ import checkNumberLength from './checkNumberLength.js';
|
|
7
7
|
* Sometimes some people incorrectly input international phone numbers
|
8
8
|
* without the leading `+`. This function corrects such input.
|
9
9
|
* @param {string} number — Phone number digits.
|
10
|
-
* @param {string
|
11
|
-
* @param {string
|
10
|
+
* @param {string} [country] — Exact country of the phone number.
|
11
|
+
* @param {string} [defaultCountry]
|
12
|
+
* @param {string} [defaultCallingCode]
|
12
13
|
* @param {object} metadata
|
13
14
|
* @return {object} `{ countryCallingCode: string?, number: string }`.
|
14
15
|
*/
|
15
|
-
function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country,
|
16
|
-
var countryCallingCode = country ? getCountryCallingCode(country, metadata) :
|
16
|
+
function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata) {
|
17
|
+
var countryCallingCode = country || defaultCountry ? getCountryCallingCode(country || defaultCountry, metadata) : defaultCallingCode;
|
17
18
|
if (number.indexOf(countryCallingCode) === 0) {
|
18
19
|
metadata = new Metadata(metadata);
|
19
|
-
metadata.selectNumberingPlan(country,
|
20
|
+
metadata.selectNumberingPlan(country || defaultCountry, countryCallingCode);
|
20
21
|
var possibleShorterNumber = number.slice(countryCallingCode.length);
|
21
|
-
var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata),
|
22
|
+
var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, country, metadata),
|
22
23
|
possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;
|
23
|
-
var _extractNationalNumbe2 = extractNationalNumber(number, metadata),
|
24
|
+
var _extractNationalNumbe2 = extractNationalNumber(number, country, metadata),
|
24
25
|
nationalNumber = _extractNationalNumbe2.nationalNumber;
|
26
|
+
|
25
27
|
// If the number was not valid before but is valid now,
|
26
28
|
// or if it was too long before, we consider the number
|
27
29
|
// with the country calling code stripped to be a better result
|
@@ -30,7 +32,7 @@ function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number,
|
|
30
32
|
// so if a number starts with `49`, it could be both a valid
|
31
33
|
// national German number or an international number without
|
32
34
|
// a leading `+`.
|
33
|
-
if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') {
|
35
|
+
if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, country, metadata) === 'TOO_LONG') {
|
34
36
|
return {
|
35
37
|
countryCallingCode: countryCallingCode,
|
36
38
|
number: possibleShorterNumber
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js"],"sourcesContent":["import Metadata from '../metadata.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport extractNationalNumber from './extractNationalNumber.js';\nimport checkNumberLength from './checkNumberLength.js';\nimport getCountryCallingCode from '../getCountryCallingCode.js';\n\n/**\r\n * Sometimes some people incorrectly input international phone numbers\r\n * without the leading `+`. This function corrects such input.\r\n * @param {string} number — Phone number digits.\r\n * @param {string
|
1
|
+
{"version":3,"file":"extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js"],"sourcesContent":["import Metadata from '../metadata.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport extractNationalNumber from './extractNationalNumber.js';\nimport checkNumberLength from './checkNumberLength.js';\nimport getCountryCallingCode from '../getCountryCallingCode.js';\n\n/**\r\n * Sometimes some people incorrectly input international phone numbers\r\n * without the leading `+`. This function corrects such input.\r\n * @param {string} number — Phone number digits.\r\n * @param {string} [country] — Exact country of the phone number.\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCode: string?, number: string }`.\r\n */\nexport default function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata) {\n var countryCallingCode = country || defaultCountry ? getCountryCallingCode(country || defaultCountry, metadata) : defaultCallingCode;\n if (number.indexOf(countryCallingCode) === 0) {\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(country || defaultCountry, countryCallingCode);\n var possibleShorterNumber = number.slice(countryCallingCode.length);\n var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, country, metadata),\n possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;\n var _extractNationalNumbe2 = extractNationalNumber(number, country, metadata),\n nationalNumber = _extractNationalNumbe2.nationalNumber;\n\n // If the number was not valid before but is valid now,\n // or if it was too long before, we consider the number\n // with the country calling code stripped to be a better result\n // and keep that instead.\n // For example, in Germany (+49), `49` is a valid area code,\n // so if a number starts with `49`, it could be both a valid\n // national German number or an international number without\n // a leading `+`.\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, country, metadata) === 'TOO_LONG') {\n return {\n countryCallingCode: countryCallingCode,\n number: possibleShorterNumber\n };\n }\n }\n return {\n number: number\n };\n}\n//# sourceMappingURL=extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map"],"names":["extractCountryCallingCodeFromInternationalNumberWithoutPlusSign","number","country","defaultCountry","defaultCallingCode","metadata","countryCallingCode","getCountryCallingCode","indexOf","Metadata","selectNumberingPlan","possibleShorterNumber","slice","length","_extractNationalNumbe","extractNationalNumber","possibleShorterNationalNumber","nationalNumber","_extractNationalNumbe2","matchesEntirely","nationalNumberPattern","checkNumberLength"],"mappings":";;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,+DAA+DA,CACtFC,MAAM,EACNC,OAAO,EACPC,cAAc,EACdC,kBAAkB,EAClBC,QAAQ,EACP;AACD,EAAA,IAAMC,kBAAkB,GAAGJ,OAAO,IAAIC,cAAc,GACjDI,qBAAqB,CAACL,OAAO,IAAIC,cAAc,EAAEE,QAAQ,CAAC,GAC1DD,kBAAkB;EAErB,IAAIH,MAAM,CAACO,OAAO,CAACF,kBAAkB,CAAC,KAAK,CAAC,EAAE;AAC7CD,IAAAA,QAAQ,GAAG,IAAII,QAAQ,CAACJ,QAAQ,CAAC;IACjCA,QAAQ,CAACK,mBAAmB,CAACR,OAAO,IAAIC,cAAc,EAAEG,kBAAkB,CAAC;IAE3E,IAAMK,qBAAqB,GAAGV,MAAM,CAACW,KAAK,CAACN,kBAAkB,CAACO,MAAM,CAAC;IAErE,IAAAC,qBAAA,GAEIC,qBAAqB,CACxBJ,qBAAqB,EACrBT,OAAO,EACPG,QACD,CAAC;MALgBW,6BAA6B,GAAAF,qBAAA,CAA7CG,cAAc;IAOf,IAAAC,sBAAA,GAEIH,qBAAqB,CACxBd,MAAM,EACNC,OAAO,EACPG,QACD,CAAC;MALAY,cAAc,GAAAC,sBAAA,CAAdD,cAAc;;AAOf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,IAEE,CAACE,eAAe,CAACF,cAAc,EAAEZ,QAAQ,CAACe,qBAAqB,EAAE,CAAC,IAClED,eAAe,CAACH,6BAA6B,EAAEX,QAAQ,CAACe,qBAAqB,EAAE,CAAC,IAGjFC,iBAAiB,CAACJ,cAAc,EAAEf,OAAO,EAAEG,QAAQ,CAAC,KAAK,UAAU,EAClE;MACD,OAAO;AACNC,QAAAA,kBAAkB,EAAlBA,kBAAkB;AAClBL,QAAAA,MAAM,EAAEU;OACR;AACF,IAAA;AACD,EAAA;EAEA,OAAO;AAAEV,IAAAA,MAAM,EAANA;GAAQ;AAClB;;;;","x_google_ignoreList":[0]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';
|
2
2
|
import matchesEntirely from './matchesEntirely.js';
|
3
3
|
import checkNumberLength from './checkNumberLength.js';
|
4
|
+
import getCountryByCallingCode from './getCountryByCallingCode.js';
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Strips national prefix and carrier code from a complete phone number.
|
@@ -8,10 +9,11 @@ import checkNumberLength from './checkNumberLength.js';
|
|
8
9
|
* it won't extract national prefix if the resultant number is too short
|
9
10
|
* to be a complete number for the selected phone numbering plan.
|
10
11
|
* @param {string} number — Complete phone number digits.
|
12
|
+
* @param {string?} country — Country, if known.
|
11
13
|
* @param {Metadata} metadata — Metadata with a phone numbering plan selected.
|
12
14
|
* @return {object} `{ nationalNumber: string, carrierCode: string? }`.
|
13
15
|
*/
|
14
|
-
function extractNationalNumber(number, metadata) {
|
16
|
+
function extractNationalNumber(number, country, metadata) {
|
15
17
|
// Parsing national prefixes and carrier codes
|
16
18
|
// is only required for local phone numbers
|
17
19
|
// but some people don't understand that
|
@@ -33,7 +35,15 @@ function extractNationalNumber(number, metadata) {
|
|
33
35
|
}
|
34
36
|
// Check the national (significant) number length after extracting national prefix and carrier code.
|
35
37
|
// Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature.
|
36
|
-
if (metadata.possibleLengths()) {
|
38
|
+
if (metadata.numberingPlan.possibleLengths()) {
|
39
|
+
// If an exact `country` is not specified, attempt to detect it from the assumed national number.
|
40
|
+
if (!country) {
|
41
|
+
country = getCountryByCallingCode(metadata.numberingPlan.callingCode(), {
|
42
|
+
nationalNumber: nationalNumber,
|
43
|
+
metadata: metadata
|
44
|
+
});
|
45
|
+
}
|
46
|
+
|
37
47
|
// The number remaining after stripping the national prefix and carrier code
|
38
48
|
// should be long enough to have a possible length for the country.
|
39
49
|
// Otherwise, don't strip the national prefix and carrier code,
|
@@ -42,7 +52,7 @@ function extractNationalNumber(number, metadata) {
|
|
42
52
|
// https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250
|
43
53
|
// It doesn't check for the "possibility" of the original `number`.
|
44
54
|
// I guess it's fine not checking that one. It works as is anyway.
|
45
|
-
if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) {
|
55
|
+
if (!isPossibleIncompleteNationalNumber(nationalNumber, country, metadata)) {
|
46
56
|
// Don't strip the national prefix.
|
47
57
|
return {
|
48
58
|
nationalNumber: number
|
@@ -91,8 +101,8 @@ function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberA
|
|
91
101
|
// }
|
92
102
|
return true;
|
93
103
|
}
|
94
|
-
function isPossibleIncompleteNationalNumber(nationalNumber, metadata) {
|
95
|
-
switch (checkNumberLength(nationalNumber, metadata)) {
|
104
|
+
function isPossibleIncompleteNationalNumber(nationalNumber, country, metadata) {
|
105
|
+
switch (checkNumberLength(nationalNumber, country, metadata)) {
|
96
106
|
case 'TOO_SHORT':
|
97
107
|
case 'INVALID_LENGTH':
|
98
108
|
// This library ignores "local-only" phone numbers (for simplicity).
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"extractNationalNumber.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js"],"sourcesContent":["import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport checkNumberLength from './checkNumberLength.js';\n\n/**\r\n * Strips national prefix and carrier code from a complete phone number.\r\n * The difference from the non-\"FromCompleteNumber\" function is that\r\n * it won't extract national prefix if the resultant number is too short\r\n * to be a complete number for the selected phone numbering plan.\r\n * @param {string} number — Complete phone number digits.\r\n * @param {Metadata} metadata — Metadata with a phone numbering plan selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\nexport default function extractNationalNumber(number, metadata) {\n // Parsing national prefixes and carrier codes\n // is only required for local phone numbers\n // but some people don't understand that\n // and sometimes write international phone numbers\n // with national prefixes (or maybe even carrier codes).\n // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n // Google's original library forgives such mistakes\n // and so does this library, because it has been requested:\n // https://github.com/catamphetamine/libphonenumber-js/issues/127\n var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),\n carrierCode = _extractNationalNumbe.carrierCode,\n nationalNumber = _extractNationalNumbe.nationalNumber;\n if (nationalNumber !== number) {\n if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n // Check the national (significant) number length after extracting national prefix and carrier code.\n // Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature.\n if (metadata.possibleLengths()) {\n // The number remaining after stripping the national prefix and carrier code\n // should be long enough to have a possible length for the country.\n // Otherwise, don't strip the national prefix and carrier code,\n // since the original number could be a valid number.\n // This check has been copy-pasted \"as is\" from Google's original library:\n // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250\n // It doesn't check for the \"possibility\" of the original `number`.\n // I guess it's fine not checking that one. It works as is anyway.\n if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n }\n }\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n\n// In some countries, the same digit could be a national prefix\n// or a leading digit of a valid phone number.\n// For example, in Russia, national prefix is `8`,\n// and also `800 555 35 35` is a valid number\n// in which `8` is not a national prefix, but the first digit\n// of a national (significant) number.\n// Same's with Belarus:\n// `82004910060` is a valid national (significant) number,\n// but `2004910060` is not.\n// To support such cases (to prevent the code from always stripping\n// national prefix), a condition is imposed: a national prefix\n// is not extracted when the original number is \"viable\" and the\n// resultant number is not, a \"viable\" national number being the one\n// that matches `national_number_pattern`.\nfunction shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {\n // The equivalent in Google's code is:\n // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004\n if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {\n return false;\n }\n // This \"is possible\" national number (length) check has been commented out\n // because it's superceded by the (effectively) same check done in the\n // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.\n // In other words, why run the same check twice if it could only be run once.\n // // Check the national (significant) number length after extracting national prefix and carrier code.\n // // Fixes a minor \"weird behavior\" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57\n // // (Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature).\n // if (metadata.possibleLengths()) {\n // \tif (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) &&\n // \t\t!isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) {\n // \t\treturn false\n // \t}\n // }\n return true;\n}\nfunction isPossibleIncompleteNationalNumber(nationalNumber, metadata) {\n switch (checkNumberLength(nationalNumber, metadata)) {\n case 'TOO_SHORT':\n case 'INVALID_LENGTH':\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n return false;\n default:\n return true;\n }\n}\n//# sourceMappingURL=extractNationalNumber.js.map"],"names":["extractNationalNumber","number","metadata","_extractNationalNumbe","extractNationalNumberFromPossiblyIncompleteNumber","carrierCode","nationalNumber","shouldHaveExtractedNationalPrefix","possibleLengths","isPossibleIncompleteNationalNumber","nationalNumberBefore","nationalNumberAfter","matchesEntirely","nationalNumberPattern","checkNumberLength"],"mappings":"
|
1
|
+
{"version":3,"file":"extractNationalNumber.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js"],"sourcesContent":["import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport checkNumberLength from './checkNumberLength.js';\nimport getCountryByCallingCode from './getCountryByCallingCode.js';\n\n/**\r\n * Strips national prefix and carrier code from a complete phone number.\r\n * The difference from the non-\"FromCompleteNumber\" function is that\r\n * it won't extract national prefix if the resultant number is too short\r\n * to be a complete number for the selected phone numbering plan.\r\n * @param {string} number — Complete phone number digits.\r\n * @param {string?} country — Country, if known.\r\n * @param {Metadata} metadata — Metadata with a phone numbering plan selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\nexport default function extractNationalNumber(number, country, metadata) {\n // Parsing national prefixes and carrier codes\n // is only required for local phone numbers\n // but some people don't understand that\n // and sometimes write international phone numbers\n // with national prefixes (or maybe even carrier codes).\n // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n // Google's original library forgives such mistakes\n // and so does this library, because it has been requested:\n // https://github.com/catamphetamine/libphonenumber-js/issues/127\n var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),\n carrierCode = _extractNationalNumbe.carrierCode,\n nationalNumber = _extractNationalNumbe.nationalNumber;\n if (nationalNumber !== number) {\n if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n // Check the national (significant) number length after extracting national prefix and carrier code.\n // Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature.\n if (metadata.numberingPlan.possibleLengths()) {\n // If an exact `country` is not specified, attempt to detect it from the assumed national number.\n if (!country) {\n country = getCountryByCallingCode(metadata.numberingPlan.callingCode(), {\n nationalNumber: nationalNumber,\n metadata: metadata\n });\n }\n\n // The number remaining after stripping the national prefix and carrier code\n // should be long enough to have a possible length for the country.\n // Otherwise, don't strip the national prefix and carrier code,\n // since the original number could be a valid number.\n // This check has been copy-pasted \"as is\" from Google's original library:\n // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250\n // It doesn't check for the \"possibility\" of the original `number`.\n // I guess it's fine not checking that one. It works as is anyway.\n if (!isPossibleIncompleteNationalNumber(nationalNumber, country, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n }\n }\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n\n// In some countries, the same digit could be a national prefix\n// or a leading digit of a valid phone number.\n// For example, in Russia, national prefix is `8`,\n// and also `800 555 35 35` is a valid number\n// in which `8` is not a national prefix, but the first digit\n// of a national (significant) number.\n// Same's with Belarus:\n// `82004910060` is a valid national (significant) number,\n// but `2004910060` is not.\n// To support such cases (to prevent the code from always stripping\n// national prefix), a condition is imposed: a national prefix\n// is not extracted when the original number is \"viable\" and the\n// resultant number is not, a \"viable\" national number being the one\n// that matches `national_number_pattern`.\nfunction shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {\n // The equivalent in Google's code is:\n // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004\n if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {\n return false;\n }\n // This \"is possible\" national number (length) check has been commented out\n // because it's superceded by the (effectively) same check done in the\n // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.\n // In other words, why run the same check twice if it could only be run once.\n // // Check the national (significant) number length after extracting national prefix and carrier code.\n // // Fixes a minor \"weird behavior\" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57\n // // (Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature).\n // if (metadata.possibleLengths()) {\n // \tif (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) &&\n // \t\t!isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) {\n // \t\treturn false\n // \t}\n // }\n return true;\n}\nfunction isPossibleIncompleteNationalNumber(nationalNumber, country, metadata) {\n switch (checkNumberLength(nationalNumber, country, metadata)) {\n case 'TOO_SHORT':\n case 'INVALID_LENGTH':\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n return false;\n default:\n return true;\n }\n}\n//# sourceMappingURL=extractNationalNumber.js.map"],"names":["extractNationalNumber","number","country","metadata","_extractNationalNumbe","extractNationalNumberFromPossiblyIncompleteNumber","carrierCode","nationalNumber","shouldHaveExtractedNationalPrefix","numberingPlan","possibleLengths","getCountryByCallingCode","callingCode","isPossibleIncompleteNationalNumber","nationalNumberBefore","nationalNumberAfter","matchesEntirely","nationalNumberPattern","checkNumberLength"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAqBA,CAACC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,IAAAC,qBAAA,GAGIC,iDAAiD,CACpDJ,MAAM,EACNE,QACD,CAAC;IALAG,WAAW,GAAAF,qBAAA,CAAXE,WAAW;IACXC,cAAc,GAAAH,qBAAA,CAAdG,cAAc;EAMf,IAAIA,cAAc,KAAKN,MAAM,EAAE;IAC9B,IAAI,CAACO,iCAAiC,CAACP,MAAM,EAAEM,cAAc,EAAEJ,QAAQ,CAAC,EAAE;AACzE;MACA,OAAO;AAAEI,QAAAA,cAAc,EAAEN;OAAQ;AAClC,IAAA;AACA;AACA;AACA,IAAA,IAAIE,QAAQ,CAACM,aAAa,CAACC,eAAe,EAAE,EAAE;AAC7C;MACA,IAAI,CAACR,OAAO,EAAE;QACbA,OAAO,GAAGS,uBAAuB,CAACR,QAAQ,CAACM,aAAa,CAACG,WAAW,EAAE,EAAE;AACvEL,UAAAA,cAAc,EAAdA,cAAc;AACdJ,UAAAA,QAAQ,EAARA;AACD,SAAC,CAAC;AACH,MAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACA,IAAI,CAACU,kCAAkC,CAACN,cAAc,EAAEL,OAAO,EAAEC,QAAQ,CAAC,EAAE;AAC3E;QACA,OAAO;AAAEI,UAAAA,cAAc,EAAEN;SAAQ;AAClC,MAAA;AACD,IAAA;AACD,EAAA;EAEA,OAAO;AAAEM,IAAAA,cAAc,EAAdA,cAAc;AAAED,IAAAA,WAAW,EAAXA;GAAa;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,iCAAiCA,CAACM,oBAAoB,EAAEC,mBAAmB,EAAEZ,QAAQ,EAAE;AAC/F;AACA;EACA,IAAIa,eAAe,CAACF,oBAAoB,EAAEX,QAAQ,CAACc,qBAAqB,EAAE,CAAC,IAC1E,CAACD,eAAe,CAACD,mBAAmB,EAAEZ,QAAQ,CAACc,qBAAqB,EAAE,CAAC,EAAE;AACzE,IAAA,OAAO,KAAK;AACb,EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,OAAO,IAAI;AACZ;AAEA,SAASJ,kCAAkCA,CAACN,cAAc,EAAEL,OAAO,EAAEC,QAAQ,EAAE;AAC9E,EAAA,QAAQe,iBAAiB,CAACX,cAAc,EAAEL,OAAO,EAAEC,QAAQ,CAAC;AAC3D,IAAA,KAAK,WAAW;AAChB,IAAA,KAAK,gBAAgB;AACrB;AACA;AACA;AACC,MAAA,OAAO,KAAK;AACb,IAAA;AACC,MAAA,OAAO,IAAI;AACb;AACD;;;;","x_google_ignoreList":[0]}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import getCountryByNationalNumber from './getCountryByNationalNumber.js';
|
2
2
|
|
3
|
+
// Returns the exact country for the `nationalNumber`
|
4
|
+
// that belongs to the specified "country calling code".
|
3
5
|
function getCountryByCallingCode(callingCode, _ref) {
|
4
6
|
var nationalPhoneNumber = _ref.nationalNumber,
|
5
|
-
defaultCountry = _ref.defaultCountry,
|
6
7
|
metadata = _ref.metadata;
|
7
8
|
var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);
|
8
9
|
if (!possibleCountries) {
|
@@ -15,7 +16,6 @@ function getCountryByCallingCode(callingCode, _ref) {
|
|
15
16
|
}
|
16
17
|
return getCountryByNationalNumber(nationalPhoneNumber, {
|
17
18
|
countries: possibleCountries,
|
18
|
-
defaultCountry: defaultCountry,
|
19
19
|
metadata: metadata.metadata
|
20
20
|
});
|
21
21
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getCountryByCallingCode.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js"],"sourcesContent":["import getCountryByNationalNumber from './getCountryByNationalNumber.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\nexport default function getCountryByCallingCode(callingCode, _ref) {\n var nationalPhoneNumber = _ref.nationalNumber,\n
|
1
|
+
{"version":3,"file":"getCountryByCallingCode.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js"],"sourcesContent":["import getCountryByNationalNumber from './getCountryByNationalNumber.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\n// Returns the exact country for the `nationalNumber`\n// that belongs to the specified \"country calling code\".\nexport default function getCountryByCallingCode(callingCode, _ref) {\n var nationalPhoneNumber = _ref.nationalNumber,\n metadata = _ref.metadata;\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(callingCode)) {\n return '001';\n }\n }\n var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);\n if (!possibleCountries) {\n return;\n }\n // If there's just one country corresponding to the country code,\n // then just return it, without further phone number digits validation.\n if (possibleCountries.length === 1) {\n return possibleCountries[0];\n }\n return getCountryByNationalNumber(nationalPhoneNumber, {\n countries: possibleCountries,\n metadata: metadata.metadata\n });\n}\n//# sourceMappingURL=getCountryByCallingCode.js.map"],"names":["getCountryByCallingCode","callingCode","_ref","nationalPhoneNumber","nationalNumber","metadata","possibleCountries","getCountryCodesForCallingCode","length","getCountryByNationalNumber","countries"],"mappings":";;AAIA;AACA;AACe,SAASA,uBAAuBA,CAACC,WAAW,EAAAC,IAAA,EAGxD;AAAA,EAAA,IAFcC,mBAAmB,GAAAD,IAAA,CAAnCE,cAAc;IACdC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;AAQR,EAAA,IAAMC,iBAAiB,GAAGD,QAAQ,CAACE,6BAA6B,CAACN,WAAW,CAAC;EAC7E,IAAI,CAACK,iBAAiB,EAAE;AACvB,IAAA;AACD,EAAA;AACA;AACA;AACA,EAAA,IAAIA,iBAAiB,CAACE,MAAM,KAAK,CAAC,EAAE;IACnC,OAAOF,iBAAiB,CAAC,CAAC,CAAC;AAC5B,EAAA;EACA,OAAOG,0BAA0B,CAACN,mBAAmB,EAAE;AACtDO,IAAAA,SAAS,EAAEJ,iBAAiB;IAC5BD,QAAQ,EAAEA,QAAQ,CAACA;AACpB,GAAC,CAAC;AACH;;;;","x_google_ignoreList":[0]}
|
@@ -30,10 +30,12 @@ function _arrayLikeToArray(r, a) {
|
|
30
30
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
31
31
|
return n;
|
32
32
|
}
|
33
|
+
|
34
|
+
// Returns the exact country that the `nationalPhoneNumber` belongs to
|
35
|
+
// in cases of ambiguity, i.e. when multiple countries share the same "country calling code".
|
33
36
|
function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
34
|
-
var countries = _ref.countries
|
35
|
-
_ref.
|
36
|
-
var metadata = _ref.metadata;
|
37
|
+
var countries = _ref.countries,
|
38
|
+
metadata = _ref.metadata;
|
37
39
|
// Re-create `metadata` because it will be selecting a `country`.
|
38
40
|
metadata = new Metadata(metadata);
|
39
41
|
|
@@ -41,7 +43,7 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
|
41
43
|
|
42
44
|
for (var _iterator = _createForOfIteratorHelperLoose(countries), _step; !(_step = _iterator()).done;) {
|
43
45
|
var country = _step.value;
|
44
|
-
metadata.
|
46
|
+
metadata.selectNumberingPlan(country);
|
45
47
|
// "Leading digits" patterns are only defined for about 20% of all countries.
|
46
48
|
// By definition, matching "leading digits" is a sufficient but not a necessary
|
47
49
|
// condition for a phone number to belong to a country.
|
@@ -60,16 +62,36 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
|
60
62
|
phone: nationalPhoneNumber,
|
61
63
|
country: country
|
62
64
|
}, undefined, metadata.metadata)) {
|
63
|
-
//
|
64
|
-
//
|
65
|
+
// When multiple countries share the same "country calling code",
|
66
|
+
// type patterns aren't guaranteed to be unique among them.
|
67
|
+
// For example, both `US` and `CA` have the same pattern for `toll_free` numbers.
|
68
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417147572
|
69
|
+
//
|
70
|
+
// That means that this `if` condition could be `true` for multiple countries from the list.
|
71
|
+
// Currently, it just returns the first one, which is also the "main" country for the "country calling code".
|
72
|
+
// In an example with `toll_free` numbers above, `"US"` would be returned even though
|
73
|
+
// it could as well be `"CA"`.
|
74
|
+
//
|
75
|
+
// There was also a time when this attempted to be overly smart
|
76
|
+
// and kept track of all such multiple matching countries
|
77
|
+
// and then picked the one that matched the `defaultCountry`, if provided.
|
78
|
+
// For example, with `toll_free` numbers above, and with `defaultCountry: "CA"`,
|
79
|
+
// it would've returned `"CA"` instead of `"US"`.
|
80
|
+
// Later it turned out that such "overly smart" behavior turned out to be just confusing,
|
81
|
+
// so this "overly smart" country detection was reverted to returning the "main" country
|
82
|
+
// for the "country calling code".
|
65
83
|
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/154
|
84
|
+
//
|
66
85
|
return country;
|
67
|
-
//
|
86
|
+
//
|
87
|
+
// The "overly smart" behavior code:
|
88
|
+
//
|
68
89
|
// if (defaultCountry) {
|
69
90
|
// if (country === defaultCountry) {
|
70
91
|
// return country
|
92
|
+
// } else {
|
93
|
+
// matchingCountries.push(country)
|
71
94
|
// }
|
72
|
-
// matchingCountries.push(country)
|
73
95
|
// } else {
|
74
96
|
// return country
|
75
97
|
// }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getCountryByNationalNumber.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js"],"sourcesContent":["function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport Metadata from '../metadata.js';\nimport getNumberType from './getNumberType.js';\nexport default function getCountryByNationalNumber(nationalPhoneNumber, _ref) {\n var countries = _ref.countries,\n
|
1
|
+
{"version":3,"file":"getCountryByNationalNumber.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js"],"sourcesContent":["function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport Metadata from '../metadata.js';\nimport getNumberType from './getNumberType.js';\n\n// Returns the exact country that the `nationalPhoneNumber` belongs to\n// in cases of ambiguity, i.e. when multiple countries share the same \"country calling code\".\nexport default function getCountryByNationalNumber(nationalPhoneNumber, _ref) {\n var countries = _ref.countries,\n metadata = _ref.metadata;\n // Re-create `metadata` because it will be selecting a `country`.\n metadata = new Metadata(metadata);\n\n // const matchingCountries = []\n\n for (var _iterator = _createForOfIteratorHelperLoose(countries), _step; !(_step = _iterator()).done;) {\n var country = _step.value;\n metadata.selectNumberingPlan(country);\n // \"Leading digits\" patterns are only defined for about 20% of all countries.\n // By definition, matching \"leading digits\" is a sufficient but not a necessary\n // condition for a phone number to belong to a country.\n // The point of \"leading digits\" check is that it's the fastest one to get a match.\n // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits\n // I'd suppose that \"leading digits\" patterns are mutually exclusive for different countries\n // because of the intended use of that feature.\n if (metadata.leadingDigits()) {\n if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {\n return country;\n }\n }\n // Else perform full validation with all of those\n // fixed-line/mobile/etc regular expressions.\n else if (getNumberType({\n phone: nationalPhoneNumber,\n country: country\n }, undefined, metadata.metadata)) {\n // When multiple countries share the same \"country calling code\",\n // type patterns aren't guaranteed to be unique among them.\n // For example, both `US` and `CA` have the same pattern for `toll_free` numbers.\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417147572\n //\n // That means that this `if` condition could be `true` for multiple countries from the list.\n // Currently, it just returns the first one, which is also the \"main\" country for the \"country calling code\".\n // In an example with `toll_free` numbers above, `\"US\"` would be returned even though\n // it could as well be `\"CA\"`.\n //\n // There was also a time when this attempted to be overly smart\n // and kept track of all such multiple matching countries\n // and then picked the one that matched the `defaultCountry`, if provided.\n // For example, with `toll_free` numbers above, and with `defaultCountry: \"CA\"`,\n // it would've returned `\"CA\"` instead of `\"US\"`.\n // Later it turned out that such \"overly smart\" behavior turned out to be just confusing,\n // so this \"overly smart\" country detection was reverted to returning the \"main\" country\n // for the \"country calling code\".\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/154\n //\n return country;\n //\n // The \"overly smart\" behavior code:\n //\n // if (defaultCountry) {\n // \tif (country === defaultCountry) {\n // \t\treturn country\n // \t} else {\n // \t\tmatchingCountries.push(country)\n // \t}\n // } else {\n // \treturn country\n // }\n }\n }\n\n // // Return the first (\"main\") one of the `matchingCountries`.\n // if (matchingCountries.length > 0) {\n // \treturn matchingCountries[0]\n // }\n}\n//# sourceMappingURL=getCountryByNationalNumber.js.map"],"names":["getCountryByNationalNumber","nationalPhoneNumber","_ref","countries","metadata","Metadata","_iterator","_createForOfIteratorHelperLoose","_step","done","country","value","selectNumberingPlan","leadingDigits","search","getNumberType","phone","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AACA;AACe,SAASA,0BAA0BA,CAACC,mBAAmB,EAAAC,IAAA,EAGnE;AAAA,EAAA,IAFFC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;AAER;AACAA,EAAAA,QAAQ,GAAG,IAAIC,QAAQ,CAACD,QAAQ,CAAC;;AAEjC;;AAEA,EAAA,KAAA,IAAAE,SAAA,GAAAC,+BAAA,CAAsBJ,SAAS,CAAA,EAAAK,KAAA,EAAA,CAAA,CAAAA,KAAA,GAAAF,SAAA,EAAA,EAAAG,IAAA,GAAE;AAAA,IAAA,IAAtBC,OAAO,GAAAF,KAAA,CAAAG,KAAA;AACjBP,IAAAA,QAAQ,CAACQ,mBAAmB,CAACF,OAAO,CAAC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,IAAIN,QAAQ,CAACS,aAAa,EAAE,EAAE;AAC7B,MAAA,IAAIZ,mBAAmB,IACtBA,mBAAmB,CAACa,MAAM,CAACV,QAAQ,CAACS,aAAa,EAAE,CAAC,KAAK,CAAC,EAAE;AAC5D,QAAA,OAAOH,OAAO;AACf,MAAA;AACD,IAAA;AACA;AACA;SACK,IAAIK,aAAa,CAAC;AAAEC,MAAAA,KAAK,EAAEf,mBAAmB;AAAES,MAAAA,OAAO,EAAPA;AAAQ,KAAC,EAAEO,SAAS,EAAEb,QAAQ,CAACA,QAAQ,CAAC,EAAE;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAA,OAAOM,OAAO;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD,IAAA;AACD,EAAA;;AAEA;AACA;AACA;AACA;AACD;;;;","x_google_ignoreList":[0]}
|
@@ -3,11 +3,11 @@
|
|
3
3
|
* against the regular expression.
|
4
4
|
* @return {boolean}
|
5
5
|
*/
|
6
|
-
function matchesEntirely(text,
|
7
|
-
// If assigning the `''` default value is moved to the arguments above,
|
8
|
-
// code coverage would decrease for some weird reason.
|
6
|
+
function matchesEntirely(text, regularExpressionText) {
|
7
|
+
// If the assigning of the `''` default value is moved to the arguments above,
|
8
|
+
// the code coverage would decrease for some weird reason.
|
9
9
|
text = text || '';
|
10
|
-
return new RegExp('^(?:' +
|
10
|
+
return new RegExp('^(?:' + regularExpressionText + ')$').test(text);
|
11
11
|
}
|
12
12
|
|
13
13
|
export { matchesEntirely as default };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"matchesEntirely.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js"],"sourcesContent":["/**\r\n * Checks whether the entire input sequence can be matched\r\n * against the regular expression.\r\n * @return {boolean}\r\n */\nexport default function matchesEntirely(text,
|
1
|
+
{"version":3,"file":"matchesEntirely.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js"],"sourcesContent":["/**\r\n * Checks whether the entire input sequence can be matched\r\n * against the regular expression.\r\n * @return {boolean}\r\n */\nexport default function matchesEntirely(text, regularExpressionText) {\n // If the assigning of the `''` default value is moved to the arguments above,\n // the code coverage would decrease for some weird reason.\n text = text || '';\n return new RegExp('^(?:' + regularExpressionText + ')$').test(text);\n}\n//# sourceMappingURL=matchesEntirely.js.map"],"names":["matchesEntirely","text","regularExpressionText","RegExp","test"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACe,SAASA,eAAeA,CAACC,IAAI,EAAEC,qBAAqB,EAAE;AACpE;AACA;EACAD,IAAI,GAAGA,IAAI,IAAI,EAAE;AACjB,EAAA,OAAO,IAAIE,MAAM,CAAC,MAAM,GAAGD,qBAAqB,GAAG,IAAI,CAAC,CAACE,IAAI,CAACH,IAAI,CAAC;AACpE;;;;","x_google_ignoreList":[0]}
|
@@ -33,7 +33,7 @@ function isPossiblePhoneNumber(input, options, metadata) {
|
|
33
33
|
if (!metadata.hasCountry(input.country)) {
|
34
34
|
throw new Error("Unknown country: ".concat(input.country));
|
35
35
|
}
|
36
|
-
metadata.
|
36
|
+
metadata.selectNumberingPlan(input.country);
|
37
37
|
} else {
|
38
38
|
if (!input.countryCallingCode) {
|
39
39
|
throw new Error('Invalid phone number object passed');
|
@@ -44,7 +44,7 @@ function isPossiblePhoneNumber(input, options, metadata) {
|
|
44
44
|
|
45
45
|
// Old metadata (< 1.0.18) had no "possible length" data.
|
46
46
|
if (metadata.possibleLengths()) {
|
47
|
-
return isPossibleNumber(input.phone || input.nationalNumber, metadata);
|
47
|
+
return isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata);
|
48
48
|
} else {
|
49
49
|
// There was a bug between `1.7.35` and `1.7.37` where "possible_lengths"
|
50
50
|
// were missing for "non-geographical" numbering plans.
|
@@ -61,9 +61,9 @@ function isPossiblePhoneNumber(input, options, metadata) {
|
|
61
61
|
}
|
62
62
|
}
|
63
63
|
}
|
64
|
-
function isPossibleNumber(nationalNumber, metadata) {
|
64
|
+
function isPossibleNumber(nationalNumber, country, metadata) {
|
65
65
|
//, isInternational) {
|
66
|
-
switch (checkNumberLength(nationalNumber, metadata)) {
|
66
|
+
switch (checkNumberLength(nationalNumber, country, metadata)) {
|
67
67
|
case 'IS_POSSIBLE':
|
68
68
|
return true;
|
69
69
|
// This library ignores "local-only" phone numbers (for simplicity).
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"isPossible.js","sources":["../../../../node_modules/libphonenumber-js/es6/isPossible.js"],"sourcesContent":["import Metadata from './metadata.js';\nimport checkNumberLength from './helpers/checkNumberLength.js';\n\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\r\n *\r\n * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {object} [options]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\nexport default function isPossiblePhoneNumber(input, options, metadata) {\n /* istanbul ignore if */\n if (options === undefined) {\n options = {};\n }\n metadata = new Metadata(metadata);\n if (options.v2) {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n metadata.selectNumberingPlan(input.countryCallingCode);\n } else {\n if (!input.phone) {\n return false;\n }\n if (input.country) {\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n metadata.
|
1
|
+
{"version":3,"file":"isPossible.js","sources":["../../../../node_modules/libphonenumber-js/es6/isPossible.js"],"sourcesContent":["import Metadata from './metadata.js';\nimport checkNumberLength from './helpers/checkNumberLength.js';\n\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\r\n *\r\n * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {object} [options]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\nexport default function isPossiblePhoneNumber(input, options, metadata) {\n /* istanbul ignore if */\n if (options === undefined) {\n options = {};\n }\n metadata = new Metadata(metadata);\n if (options.v2) {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n metadata.selectNumberingPlan(input.countryCallingCode);\n } else {\n if (!input.phone) {\n return false;\n }\n if (input.country) {\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n metadata.selectNumberingPlan(input.country);\n } else {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n metadata.selectNumberingPlan(input.countryCallingCode);\n }\n }\n\n // Old metadata (< 1.0.18) had no \"possible length\" data.\n if (metadata.possibleLengths()) {\n return isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata);\n } else {\n // There was a bug between `1.7.35` and `1.7.37` where \"possible_lengths\"\n // were missing for \"non-geographical\" numbering plans.\n // Just assume the number is possible in such cases:\n // it's unlikely that anyone generated their custom metadata\n // in that short period of time (one day).\n // This code can be removed in some future major version update.\n if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {\n // \"Non-geographic entities\" did't have `possibleLengths`\n // due to a bug in metadata generation process.\n return true;\n } else {\n throw new Error('Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.');\n }\n }\n}\nexport function isPossibleNumber(nationalNumber, country, metadata) {\n //, isInternational) {\n switch (checkNumberLength(nationalNumber, country, metadata)) {\n case 'IS_POSSIBLE':\n return true;\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // \treturn !isInternational\n default:\n return false;\n }\n}\n//# sourceMappingURL=isPossible.js.map"],"names":["isPossiblePhoneNumber","input","options","metadata","undefined","Metadata","v2","countryCallingCode","Error","selectNumberingPlan","phone","country","hasCountry","concat","possibleLengths","isPossibleNumber","nationalNumber","isNonGeographicCallingCode","checkNumberLength"],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAqBA,CAACC,KAAK,EAAEC,OAAO,EAAEC,QAAQ,EAAE;AACvE;EACA,IAAID,OAAO,KAAKE,SAAS,EAAE;IAC1BF,OAAO,GAAG,EAAE;AACb,EAAA;AAEAC,EAAAA,QAAQ,GAAG,IAAIE,QAAQ,CAACF,QAAQ,CAAC;EAEjC,IAAID,OAAO,CAACI,EAAE,EAAE;AACf,IAAA,IAAI,CAACL,KAAK,CAACM,kBAAkB,EAAE;AAC9B,MAAA,MAAM,IAAIC,KAAK,CAAC,oCAAoC,CAAC;AACtD,IAAA;AACAL,IAAAA,QAAQ,CAACM,mBAAmB,CAACR,KAAK,CAACM,kBAAkB,CAAC;AACvD,EAAA,CAAC,MAAM;AACN,IAAA,IAAI,CAACN,KAAK,CAACS,KAAK,EAAE;AACjB,MAAA,OAAO,KAAK;AACb,IAAA;IACA,IAAIT,KAAK,CAACU,OAAO,EAAE;MAClB,IAAI,CAACR,QAAQ,CAACS,UAAU,CAACX,KAAK,CAACU,OAAO,CAAC,EAAE;QACxC,MAAM,IAAIH,KAAK,CAAA,mBAAA,CAAAK,MAAA,CAAqBZ,KAAK,CAACU,OAAO,CAAE,CAAC;AACrD,MAAA;AACAR,MAAAA,QAAQ,CAACM,mBAAmB,CAACR,KAAK,CAACU,OAAO,CAAC;AAC5C,IAAA,CAAC,MAAM;AACN,MAAA,IAAI,CAACV,KAAK,CAACM,kBAAkB,EAAE;AAC9B,QAAA,MAAM,IAAIC,KAAK,CAAC,oCAAoC,CAAC;AACtD,MAAA;AACAL,MAAAA,QAAQ,CAACM,mBAAmB,CAACR,KAAK,CAACM,kBAAkB,CAAC;AACvD,IAAA;AACD,EAAA;;AAEA;AACA,EAAA,IAAIJ,QAAQ,CAACW,eAAe,EAAE,EAAE;AAC/B,IAAA,OAAOC,gBAAgB,CAACd,KAAK,CAACS,KAAK,IAAIT,KAAK,CAACe,cAAc,EAAEf,KAAK,CAACU,OAAO,EAAER,QAAQ,CAAC;AACtF,EAAA,CAAC,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,IAAIF,KAAK,CAACM,kBAAkB,IAAIJ,QAAQ,CAACc,0BAA0B,CAAChB,KAAK,CAACM,kBAAkB,CAAC,EAAE;AAC9F;AACA;AACA,MAAA,OAAO,IAAI;AACZ,IAAA,CAAC,MAAM;AACN,MAAA,MAAM,IAAIC,KAAK,CAAC,gGAAgG,CAAC;AAClH,IAAA;AACD,EAAA;AACD;AAEO,SAASO,gBAAgBA,CAACC,cAAc,EAAEL,OAAO,EAAER,QAAQ,EAAE;AAAE;AACrE,EAAA,QAAQe,iBAAiB,CAACF,cAAc,EAAEL,OAAO,EAAER,QAAQ,CAAC;AAC3D,IAAA,KAAK,aAAa;AACjB,MAAA,OAAO,IAAI;AACZ;AACA;AACA;AACA;AACA,IAAA;AACC,MAAA,OAAO,KAAK;AACd;AACD;;;;","x_google_ignoreList":[0]}
|
@@ -601,7 +601,7 @@ var typeOf = function typeOf(_) {
|
|
601
601
|
function getCountryCallingCode(country, metadata) {
|
602
602
|
metadata = new Metadata(metadata);
|
603
603
|
if (metadata.hasCountry(country)) {
|
604
|
-
return metadata.
|
604
|
+
return metadata.selectNumberingPlan(country).countryCallingCode();
|
605
605
|
}
|
606
606
|
throw new Error("Unknown country: ".concat(country));
|
607
607
|
}
|