libphonenumber-js 1.10.60 → 1.10.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/isValid.js CHANGED
@@ -52,15 +52,6 @@ function isValidNumber(input, options, metadata) {
52
52
  // code coverage would decrease for some weird reason.
53
53
  options = options || {};
54
54
  metadata = new _metadata["default"](metadata);
55
- /**
56
- * Checks if a phone number is "possible" (basically just checks its length).
57
- *
58
- * @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: '...' }`.
59
- * @param {object} [options]
60
- * @param {object} metadata
61
- * @return {string}
62
- */
63
-
64
55
  metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for
65
56
  // distinguishing different countries having the same `countryCallingCode`.
66
57
 
@@ -1 +1 @@
1
- {"version":3,"file":"isValid.js","names":["isValidNumber","input","options","metadata","Metadata","selectNumberingPlan","country","countryCallingCode","hasTypes","getNumberType","undefined","nationalNumber","v2","phone","matchesEntirely","nationalNumberPattern"],"sources":["../source/isValid.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport matchesEntirely from './helpers/matchesEntirely.js'\r\nimport getNumberType from './helpers/getNumberType.js'\r\n\r\n/**\r\n * Checks if a given phone number is valid.\r\n *\r\n * isValid(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 * If the `number` is a string, it will be parsed to an object,\r\n * but only if it contains only valid phone number characters (including punctuation).\r\n * If the `number` is an object, it is used as is.\r\n *\r\n * The optional `defaultCountry` argument is the default country.\r\n * I.e. it does not restrict to just that country,\r\n * e.g. in those cases where several countries share\r\n * the same phone numbering rules (NANPA, Britain, etc).\r\n * For example, even though the number `07624 369230`\r\n * belongs to the Isle of Man (\"IM\" country code)\r\n * calling `isValidNumber('07624369230', 'GB', metadata)`\r\n * still returns `true` because the country is not restricted to `GB`,\r\n * it's just that `GB` is the default one for the phone numbering rules.\r\n * For restricting the country see `isValidNumberForRegion()`\r\n * though restricting a country might not be a good idea.\r\n * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\r\n *\r\n * Examples:\r\n *\r\n * ```js\r\n * isValidNumber('+78005553535', metadata)\r\n * isValidNumber('8005553535', 'RU', metadata)\r\n * isValidNumber('88005553535', 'RU', metadata)\r\n * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)\r\n * ```\r\n */\r\nexport default function isValidNumber(input, options, metadata)\r\n{\r\n\t// If assigning the `{}` default value is moved to the arguments above,\r\n\t// code coverage would decrease for some weird reason.\r\n\toptions = options || {}\r\n\r\n\tmetadata = new Metadata(metadata)\r\n\r\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\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 */\r\n\r\n\tmetadata.selectNumberingPlan(input.country, input.countryCallingCode)\r\n\r\n\t// By default, countries only have type regexps when it's required for\r\n\t// distinguishing different countries having the same `countryCallingCode`.\r\n\tif (metadata.hasTypes()) {\r\n\t\treturn getNumberType(input, options, metadata.metadata) !== undefined\r\n\t}\r\n\r\n\t// If there are no type regexps for this country in metadata then use\r\n\t// `nationalNumberPattern` as a \"better than nothing\" replacement.\r\n\tconst nationalNumber = options.v2 ? input.nationalNumber : input.phone\r\n\treturn matchesEntirely(nationalNumber, metadata.nationalNumberPattern())\r\n}"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;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;AACe,SAASA,aAAT,CAAuBC,KAAvB,EAA8BC,OAA9B,EAAuCC,QAAvC,EACf;EACC;EACA;EACAD,OAAO,GAAGA,OAAO,IAAI,EAArB;EAEAC,QAAQ,GAAG,IAAIC,oBAAJ,CAAaD,QAAb,CAAX;EAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAECA,QAAQ,CAACE,mBAAT,CAA6BJ,KAAK,CAACK,OAAnC,EAA4CL,KAAK,CAACM,kBAAlD,EAhBD,CAkBC;EACA;;EACA,IAAIJ,QAAQ,CAACK,QAAT,EAAJ,EAAyB;IACxB,OAAO,IAAAC,yBAAA,EAAcR,KAAd,EAAqBC,OAArB,EAA8BC,QAAQ,CAACA,QAAvC,MAAqDO,SAA5D;EACA,CAtBF,CAwBC;EACA;;;EACA,IAAMC,cAAc,GAAGT,OAAO,CAACU,EAAR,GAAaX,KAAK,CAACU,cAAnB,GAAoCV,KAAK,CAACY,KAAjE;EACA,OAAO,IAAAC,2BAAA,EAAgBH,cAAhB,EAAgCR,QAAQ,CAACY,qBAAT,EAAhC,CAAP;AACA"}
1
+ {"version":3,"file":"isValid.js","names":["isValidNumber","input","options","metadata","Metadata","selectNumberingPlan","country","countryCallingCode","hasTypes","getNumberType","undefined","nationalNumber","v2","phone","matchesEntirely","nationalNumberPattern"],"sources":["../source/isValid.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport matchesEntirely from './helpers/matchesEntirely.js'\r\nimport getNumberType from './helpers/getNumberType.js'\r\n\r\n/**\r\n * Checks if a given phone number is valid.\r\n *\r\n * isValid(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 * If the `number` is a string, it will be parsed to an object,\r\n * but only if it contains only valid phone number characters (including punctuation).\r\n * If the `number` is an object, it is used as is.\r\n *\r\n * The optional `defaultCountry` argument is the default country.\r\n * I.e. it does not restrict to just that country,\r\n * e.g. in those cases where several countries share\r\n * the same phone numbering rules (NANPA, Britain, etc).\r\n * For example, even though the number `07624 369230`\r\n * belongs to the Isle of Man (\"IM\" country code)\r\n * calling `isValidNumber('07624369230', 'GB', metadata)`\r\n * still returns `true` because the country is not restricted to `GB`,\r\n * it's just that `GB` is the default one for the phone numbering rules.\r\n * For restricting the country see `isValidNumberForRegion()`\r\n * though restricting a country might not be a good idea.\r\n * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\r\n *\r\n * Examples:\r\n *\r\n * ```js\r\n * isValidNumber('+78005553535', metadata)\r\n * isValidNumber('8005553535', 'RU', metadata)\r\n * isValidNumber('88005553535', 'RU', metadata)\r\n * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)\r\n * ```\r\n */\r\nexport default function isValidNumber(input, options, metadata)\r\n{\r\n\t// If assigning the `{}` default value is moved to the arguments above,\r\n\t// code coverage would decrease for some weird reason.\r\n\toptions = options || {}\r\n\r\n\tmetadata = new Metadata(metadata)\r\n\r\n\tmetadata.selectNumberingPlan(input.country, input.countryCallingCode)\r\n\r\n\t// By default, countries only have type regexps when it's required for\r\n\t// distinguishing different countries having the same `countryCallingCode`.\r\n\tif (metadata.hasTypes()) {\r\n\t\treturn getNumberType(input, options, metadata.metadata) !== undefined\r\n\t}\r\n\r\n\t// If there are no type regexps for this country in metadata then use\r\n\t// `nationalNumberPattern` as a \"better than nothing\" replacement.\r\n\tconst nationalNumber = options.v2 ? input.nationalNumber : input.phone\r\n\treturn matchesEntirely(nationalNumber, metadata.nationalNumberPattern())\r\n}"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;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;AACe,SAASA,aAAT,CAAuBC,KAAvB,EAA8BC,OAA9B,EAAuCC,QAAvC,EACf;EACC;EACA;EACAD,OAAO,GAAGA,OAAO,IAAI,EAArB;EAEAC,QAAQ,GAAG,IAAIC,oBAAJ,CAAaD,QAAb,CAAX;EAEAA,QAAQ,CAACE,mBAAT,CAA6BJ,KAAK,CAACK,OAAnC,EAA4CL,KAAK,CAACM,kBAAlD,EAPD,CASC;EACA;;EACA,IAAIJ,QAAQ,CAACK,QAAT,EAAJ,EAAyB;IACxB,OAAO,IAAAC,yBAAA,EAAcR,KAAd,EAAqBC,OAArB,EAA8BC,QAAQ,CAACA,QAAvC,MAAqDO,SAA5D;EACA,CAbF,CAeC;EACA;;;EACA,IAAMC,cAAc,GAAGT,OAAO,CAACU,EAAR,GAAaX,KAAK,CAACU,cAAnB,GAAoCV,KAAK,CAACY,KAAjE;EACA,OAAO,IAAAC,2BAAA,EAAgBH,cAAhB,EAAgCR,QAAQ,CAACY,qBAAT,EAAhC,CAAP;AACA"}