Lines Matching refs:phonenumbers

29 goog.provide('i18n.phonenumbers.Error');
30 goog.provide('i18n.phonenumbers.PhoneNumberFormat');
31 goog.provide('i18n.phonenumbers.PhoneNumberType');
32 goog.provide('i18n.phonenumbers.PhoneNumberUtil');
33 goog.provide('i18n.phonenumbers.PhoneNumberUtil.MatchType');
34 goog.provide('i18n.phonenumbers.PhoneNumberUtil.ValidationResult');
40 goog.require('i18n.phonenumbers.NumberFormat');
41 goog.require('i18n.phonenumbers.PhoneMetadata');
42 goog.require('i18n.phonenumbers.PhoneNumber');
43 goog.require('i18n.phonenumbers.PhoneNumber.CountryCodeSource');
44 goog.require('i18n.phonenumbers.PhoneNumberDesc');
45 goog.require('i18n.phonenumbers.metadata');
53 i18n.phonenumbers.PhoneNumberUtil = function() {
56 * @type {Object.<string, i18n.phonenumbers.PhoneMetadata>}
60 goog.addSingletonGetter(i18n.phonenumbers.PhoneNumberUtil);
68 i18n.phonenumbers.Error = {
93 i18n.phonenumbers.PhoneNumberUtil.NANPA_COUNTRY_CODE_ = 1;
103 i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_FOR_NSN_ = 2;
114 i18n.phonenumbers.PhoneNumberUtil.MAX_LENGTH_FOR_NSN_ = 17;
124 i18n.phonenumbers.PhoneNumberUtil.MAX_LENGTH_COUNTRY_CODE_ = 3;
135 i18n.phonenumbers.PhoneNumberUtil.MAX_INPUT_STRING_LENGTH_ = 250;
145 i18n.phonenumbers.PhoneNumberUtil.UNKNOWN_REGION_ = 'ZZ';
158 i18n.phonenumbers.PhoneNumberUtil.MOBILE_TOKEN_MAPPINGS_ = {
172 i18n.phonenumbers.PhoneNumberUtil.GEO_MOBILE_COUNTRIES_ = [
185 i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN = '+';
193 i18n.phonenumbers.PhoneNumberUtil.STAR_SIGN_ = '*';
203 i18n.phonenumbers.PhoneNumberUtil.RFC3966_EXTN_PREFIX_ = ';ext=';
211 i18n.phonenumbers.PhoneNumberUtil.RFC3966_PREFIX_ = 'tel:';
219 i18n.phonenumbers.PhoneNumberUtil.RFC3966_PHONE_CONTEXT_ = ';phone-context=';
227 i18n.phonenumbers.PhoneNumberUtil.RFC3966_ISDN_SUBADDRESS_ = ';isub=';
238 i18n.phonenumbers.PhoneNumberUtil.DIGIT_MAPPINGS = {
291 i18n.phonenumbers.PhoneNumberUtil.DIALLABLE_CHAR_MAPPINGS_ = {
302 '+': i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN,
315 i18n.phonenumbers.PhoneNumberUtil.ALPHA_MAPPINGS_ = {
352 i18n.phonenumbers.PhoneNumberUtil.ALL_NORMALIZATION_MAPPINGS_ = {
431 i18n.phonenumbers.PhoneNumberUtil.ALL_PLUS_NUMBER_GROUPING_SYMBOLS_ = {
526 i18n.phonenumbers.PhoneNumberUtil.SINGLE_INTERNATIONAL_PREFIX_ =
542 i18n.phonenumbers.PhoneNumberUtil.VALID_PUNCTUATION =
555 i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ =
567 i18n.phonenumbers.PhoneNumberUtil.VALID_ALPHA_ = 'A-Za-z';
575 i18n.phonenumbers.PhoneNumberUtil.PLUS_CHARS_ = '+\uFF0B';
582 i18n.phonenumbers.PhoneNumberUtil.PLUS_CHARS_PATTERN =
583 new RegExp('[' + i18n.phonenumbers.PhoneNumberUtil.PLUS_CHARS_ + ']+');
591 i18n.phonenumbers.PhoneNumberUtil.LEADING_PLUS_CHARS_PATTERN =
592 new RegExp('^[' + i18n.phonenumbers.PhoneNumberUtil.PLUS_CHARS_ + ']+');
600 i18n.phonenumbers.PhoneNumberUtil.SEPARATOR_PATTERN_ =
601 '[' + i18n.phonenumbers.PhoneNumberUtil.VALID_PUNCTUATION + ']+';
608 i18n.phonenumbers.PhoneNumberUtil.CAPTURING_DIGIT_PATTERN =
609 new RegExp('([' + i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + '])');
625 i18n.phonenumbers.PhoneNumberUtil.VALID_START_CHAR_PATTERN_ =
626 new RegExp('[' + i18n.phonenumbers.PhoneNumberUtil.PLUS_CHARS_ +
627 i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + ']');
642 i18n.phonenumbers.PhoneNumberUtil.SECOND_NUMBER_START_PATTERN_ = /[\\\/] *x/;
654 i18n.phonenumbers.PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN_ =
655 new RegExp('[^' + i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ +
656 i18n.phonenumbers.PhoneNumberUtil.VALID_ALPHA_ + '#]+$');
668 i18n.phonenumbers.PhoneNumberUtil.VALID_ALPHA_PHONE_PATTERN_ =
698 i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_PHONE_NUMBER_PATTERN_ =
699 '[' + i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + ']{' +
700 i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_FOR_NSN_ + '}';
710 i18n.phonenumbers.PhoneNumberUtil.VALID_PHONE_NUMBER_ =
711 '[' + i18n.phonenumbers.PhoneNumberUtil.PLUS_CHARS_ + ']*(?:[' +
712 i18n.phonenumbers.PhoneNumberUtil.VALID_PUNCTUATION +
713 i18n.phonenumbers.PhoneNumberUtil.STAR_SIGN_ + ']*[' +
714 i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + ']){3,}[' +
715 i18n.phonenumbers.PhoneNumberUtil.VALID_PUNCTUATION +
716 i18n.phonenumbers.PhoneNumberUtil.STAR_SIGN_ +
717 i18n.phonenumbers.PhoneNumberUtil.VALID_ALPHA_ +
718 i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + ']*';
732 i18n.phonenumbers.PhoneNumberUtil.DEFAULT_EXTN_PREFIX_ = ' ext. ';
739 i18n.phonenumbers.PhoneNumberUtil.RFC3966_VISUAL_SEPARATOR_ = '[\\-\\.\\(\\)]?';
746 i18n.phonenumbers.PhoneNumberUtil.RFC3966_PHONE_DIGIT_ = '(['
747 + i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + ']|'
748 + i18n.phonenumbers.PhoneNumberUtil.RFC3966_VISUAL_SEPARATOR_ + ')';
755 i18n.phonenumbers.PhoneNumberUtil.RFC3966_GLOBAL_NUMBER_DIGITS_ = '^\\'
756 + i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN
757 + i18n.phonenumbers.PhoneNumberUtil.RFC3966_PHONE_DIGIT_ + '*['
758 + i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + ']'
759 + i18n.phonenumbers.PhoneNumberUtil.RFC3966_PHONE_DIGIT_ + '*$';
769 i18n.phonenumbers.PhoneNumberUtil.RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ =
770 new RegExp(i18n.phonenumbers.PhoneNumberUtil.RFC3966_GLOBAL_NUMBER_DIGITS_);
777 i18n.phonenumbers.PhoneNumberUtil.ALPHANUM_ =
778 i18n.phonenumbers.PhoneNumberUtil.VALID_ALPHA_
779 + i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_;
786 i18n.phonenumbers.PhoneNumberUtil.RFC3966_DOMAINLABEL_ = '['
787 + i18n.phonenumbers.PhoneNumberUtil.ALPHANUM_ + ']+((\\-)*['
788 + i18n.phonenumbers.PhoneNumberUtil.ALPHANUM_ + '])*';
795 i18n.phonenumbers.PhoneNumberUtil.RFC3966_TOPLABEL_ = '['
796 + i18n.phonenumbers.PhoneNumberUtil.VALID_ALPHA_ + ']+((\\-)*['
797 + i18n.phonenumbers.PhoneNumberUtil.ALPHANUM_ + '])*';
804 i18n.phonenumbers.PhoneNumberUtil.RFC3966_DOMAINNAME_ = '^('
805 + i18n.phonenumbers.PhoneNumberUtil.RFC3966_DOMAINLABEL_ + '\\.)*'
806 + i18n.phonenumbers.PhoneNumberUtil.RFC3966_TOPLABEL_ + '\\.?$';
816 i18n.phonenumbers.PhoneNumberUtil.RFC3966_DOMAINNAME_PATTERN_ =
817 new RegExp(i18n.phonenumbers.PhoneNumberUtil.RFC3966_DOMAINNAME_);
826 i18n.phonenumbers.PhoneNumberUtil.extnDigits_ =
828 return ('([' + i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + ']'
839 i18n.phonenumbers.PhoneNumberUtil.createExtnPattern_ =
887 var rfcExtn = i18n.phonenumbers.PhoneNumberUtil.RFC3966_EXTN_PREFIX_
888 + i18n.phonenumbers.PhoneNumberUtil.extnDigits_(extLimitAfterExplicitLabel);
892 + i18n.phonenumbers.PhoneNumberUtil.extnDigits_(extLimitAfterExplicitLabel)
897 + i18n.phonenumbers.PhoneNumberUtil.extnDigits_(extLimitAfterAmbiguousChar)
901 + i18n.phonenumbers.PhoneNumberUtil.extnDigits_(extLimitWhenNotSure) + "#";
906 + i18n.phonenumbers.PhoneNumberUtil.extnDigits_(extLimitAfterLikelyLabel)
911 + i18n.phonenumbers.PhoneNumberUtil.extnDigits_(extLimitAfterAmbiguousChar)
943 i18n.phonenumbers.PhoneNumberUtil.EXTN_PATTERN_ =
945 i18n.phonenumbers.PhoneNumberUtil.createExtnPattern_() +
957 i18n.phonenumbers.PhoneNumberUtil.VALID_PHONE_NUMBER_PATTERN_ =
960 i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_PHONE_NUMBER_PATTERN_ +
962 '^' + i18n.phonenumbers.PhoneNumberUtil.VALID_PHONE_NUMBER_ +
963 '(?:' + i18n.phonenumbers.PhoneNumberUtil.createExtnPattern_() +
972 i18n.phonenumbers.PhoneNumberUtil.NON_DIGITS_PATTERN_ = /\D+/;
984 i18n.phonenumbers.PhoneNumberUtil.FIRST_GROUP_PATTERN_ = /(\$\d)/;
992 i18n.phonenumbers.PhoneNumberUtil.NP_PATTERN_ = /\$NP/;
1000 i18n.phonenumbers.PhoneNumberUtil.FG_PATTERN_ = /\$FG/;
1008 i18n.phonenumbers.PhoneNumberUtil.CC_PATTERN_ = /\$CC/;
1019 i18n.phonenumbers.PhoneNumberUtil.FIRST_GROUP_ONLY_PREFIX_PATTERN_ =
1027 i18n.phonenumbers.PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY = '001';
1046 i18n.phonenumbers.PhoneNumberFormat = {
1059 i18n.phonenumbers.PhoneNumberType = {
1097 i18n.phonenumbers.PhoneNumberUtil.MatchType = {
1111 i18n.phonenumbers.PhoneNumberUtil.ValidationResult = {
1155 i18n.phonenumbers.PhoneNumberUtil.extractPossibleNumber = function(number) {
1161 .search(i18n.phonenumbers.PhoneNumberUtil.VALID_START_CHAR_PATTERN_);
1166 i18n.phonenumbers.PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN_, '');
1171 .search(i18n.phonenumbers.PhoneNumberUtil.SECOND_NUMBER_START_PATTERN_);
1194 i18n.phonenumbers.PhoneNumberUtil.isViablePhoneNumber = function(number) {
1195 if (number.length < i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_FOR_NSN_) {
1198 return i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
1199 i18n.phonenumbers.PhoneNumberUtil.VALID_PHONE_NUMBER_PATTERN_, number);
1220 i18n.phonenumbers.PhoneNumberUtil.normalize = function(number) {
1221 if (i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
1222 i18n.phonenumbers.PhoneNumberUtil.VALID_ALPHA_PHONE_PATTERN_, number)) {
1223 return i18n.phonenumbers.PhoneNumberUtil.normalizeHelper_(number,
1224 i18n.phonenumbers.PhoneNumberUtil.ALL_NORMALIZATION_MAPPINGS_, true);
1226 return i18n.phonenumbers.PhoneNumberUtil.normalizeDigitsOnly(number);
1240 i18n.phonenumbers.PhoneNumberUtil.normalizeSB_ = function(number) {
1242 var normalizedNumber = i18n.phonenumbers.PhoneNumberUtil.normalize(number
1257 i18n.phonenumbers.PhoneNumberUtil.normalizeDigitsOnly = function(number) {
1258 return i18n.phonenumbers.PhoneNumberUtil.normalizeHelper_(number,
1259 i18n.phonenumbers.PhoneNumberUtil.DIGIT_MAPPINGS, true);
1271 i18n.phonenumbers.PhoneNumberUtil.normalizeDiallableCharsOnly =
1274 return i18n.phonenumbers.PhoneNumberUtil.normalizeHelper_(number,
1275 i18n.phonenumbers.PhoneNumberUtil.DIALLABLE_CHAR_MAPPINGS_,
1288 i18n.phonenumbers.PhoneNumberUtil.convertAlphaCharactersInNumber =
1291 return i18n.phonenumbers.PhoneNumberUtil.normalizeHelper_(number,
1292 i18n.phonenumbers.PhoneNumberUtil.ALL_NORMALIZATION_MAPPINGS_, false);
1305 * var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
1338 * @param {i18n.phonenumbers.PhoneNumber} number the PhoneNumber object for
1342 i18n.phonenumbers.PhoneNumberUtil.prototype.getLengthOfGeographicalAreaCode =
1344 /** @type {i18n.phonenumbers.PhoneMetadata} */
1377 * var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
1400 * @param {i18n.phonenumbers.PhoneNumber} number the PhoneNumber object for
1405 i18n.phonenumbers.PhoneNumberUtil.prototype.getLengthOfNationalDestinationCode =
1408 /** @type {i18n.phonenumbers.PhoneNumber} */
1422 i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL);
1425 i18n.phonenumbers.PhoneNumberUtil.NON_DIGITS_PATTERN_);
1440 if (this.getNumberType(number) == i18n.phonenumbers.PhoneNumberType.MOBILE) {
1448 var mobileToken = i18n.phonenumbers.PhoneNumberUtil.getCountryMobileToken(
1468 i18n.phonenumbers.PhoneNumberUtil.getCountryMobileToken =
1470 return i18n.phonenumbers.PhoneNumberUtil.MOBILE_TOKEN_MAPPINGS_[
1481 i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedRegions = function() {
1482 return Object.keys(i18n.phonenumbers.metadata.countryToMetadata)
1495 i18n.phonenumbers.PhoneNumberUtil.prototype
1498 Object.keys(i18n.phonenumbers.metadata.countryToMetadata)
1517 i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedCallingCodes =
1520 Object.keys(i18n.phonenumbers.metadata.countryCodeToRegionCodeMap);
1534 * @param {i18n.phonenumbers.PhoneNumberDesc} desc
1538 i18n.phonenumbers.PhoneNumberUtil.descHasPossibleNumberData_ = function(desc) {
1549 * @param {i18n.phonenumbers.PhoneNumberDesc} desc
1553 i18n.phonenumbers.PhoneNumberUtil.descHasData_ = function(desc) {
1560 i18n.phonenumbers.PhoneNumberUtil.descHasPossibleNumberData_(desc) ||
1569 * @param {!i18n.phonenumbers.PhoneMetadata} metadata
1570 * @return {!Array.<i18n.phonenumbers.PhoneNumberType>} the types supported
1574 i18n.phonenumbers.PhoneNumberUtil.getSupportedTypesForMetadata_ =
1576 /** @type {!Array.<i18n.phonenumbers.PhoneNumberType>} */
1578 goog.object.forEach(i18n.phonenumbers.PhoneNumberType,
1580 if (type == i18n.phonenumbers.PhoneNumberType.FIXED_LINE_OR_MOBILE ||
1581 type == i18n.phonenumbers.PhoneNumberType.UNKNOWN) {
1587 /** @type {i18n.phonenumbers.PhoneNumberDesc} */
1588 var desc = i18n.phonenumbers.PhoneNumberUtil.getNumberDescByType_(
1590 if (i18n.phonenumbers.PhoneNumberUtil.descHasData_(desc)) {
1607 * @return {!Array.<i18n.phonenumbers.PhoneNumberType>} the types for every
1610 i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedTypesForRegion =
1615 return i18n.phonenumbers.PhoneNumberUtil.getSupportedTypesForMetadata_(
1616 /** @type {!i18n.phonenumbers.PhoneMetadata} */ (
1632 * @return {!Array.<i18n.phonenumbers.PhoneNumberType>} the types for every
1635 i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedTypesForNonGeoEntity =
1637 /** @type {i18n.phonenumbers.PhoneMetadata} */
1642 return i18n.phonenumbers.PhoneNumberUtil.getSupportedTypesForMetadata_(
1643 /** @type {!i18n.phonenumbers.PhoneMetadata} */ (metadata));
1662 i18n.phonenumbers.PhoneNumberUtil.normalizeHelper_ =
1696 i18n.phonenumbers.PhoneNumberUtil.prototype.formattingRuleHasFirstGroupOnly =
1699 i18n.phonenumbers.PhoneNumberUtil.FIRST_GROUP_ONLY_PREFIX_PATTERN_.
1709 * @param {i18n.phonenumbers.PhoneNumber} phoneNumber The phone number to test.
1712 i18n.phonenumbers.PhoneNumberUtil.prototype.isNumberGeographical =
1714 /** @type {i18n.phonenumbers.PhoneNumberType} */
1717 return numberType == i18n.phonenumbers.PhoneNumberType.FIXED_LINE ||
1718 numberType == i18n.phonenumbers.PhoneNumberType.FIXED_LINE_OR_MOBILE ||
1719 (i18n.phonenumbers.PhoneNumberUtil.GEO_MOBILE_COUNTRIES_.includes(
1721 numberType == i18n.phonenumbers.PhoneNumberType.MOBILE);
1732 i18n.phonenumbers.PhoneNumberUtil.prototype.isValidRegionCode_ =
1745 regionCode.toUpperCase() in i18n.phonenumbers.metadata.countryToMetadata;
1756 i18n.phonenumbers.PhoneNumberUtil.prototype.hasValidCountryCallingCode_ =
1760 i18n.phonenumbers.metadata.countryCodeToRegionCodeMap;
1775 * @param {i18n.phonenumbers.PhoneNumber} number the phone number to be
1777 * @param {i18n.phonenumbers.PhoneNumberFormat} numberFormat the format the
1781 i18n.phonenumbers.PhoneNumberUtil.prototype.format =
1800 if (numberFormat == i18n.phonenumbers.PhoneNumberFormat.E164) {
1805 countryCallingCode, i18n.phonenumbers.PhoneNumberFormat.E164,
1821 /** @type {i18n.phonenumbers.PhoneMetadata} */
1845 * @param {i18n.phonenumbers.PhoneNumber} number the phone number to be
1847 * @param {i18n.phonenumbers.PhoneNumberFormat} numberFormat the format the
1849 * @param {Array.<i18n.phonenumbers.NumberFormat>} userDefinedFormats formatting
1853 i18n.phonenumbers.PhoneNumberUtil.prototype.formatByPattern =
1870 /** @type {i18n.phonenumbers.PhoneMetadata} */
1877 /** @type {i18n.phonenumbers.NumberFormat} */
1887 /** @type {i18n.phonenumbers.NumberFormat} */
1898 .replace(i18n.phonenumbers.PhoneNumberUtil.NP_PATTERN_,
1900 .replace(i18n.phonenumbers.PhoneNumberUtil.FG_PATTERN_, '$1');
1930 * @param {i18n.phonenumbers.PhoneNumber} number the phone number to be
1936 i18n.phonenumbers.PhoneNumberUtil.prototype.
1954 /** @type {i18n.phonenumbers.PhoneMetadata} */
1959 number, metadata, i18n.phonenumbers.PhoneNumberFormat.NATIONAL);
1963 i18n.phonenumbers.PhoneNumberFormat.NATIONAL, carrierCode);
1965 countryCallingCode, i18n.phonenumbers.PhoneNumberFormat.NATIONAL,
1973 * @return {i18n.phonenumbers.PhoneMetadata}
1976 i18n.phonenumbers.PhoneNumberUtil.prototype.getMetadataForRegionOrCallingCode_ =
1978 return i18n.phonenumbers.PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY ==
1997 * @param {i18n.phonenumbers.PhoneNumber} number the phone number to be
2005 i18n.phonenumbers.PhoneNumberUtil.prototype.
2026 * @param {i18n.phonenumbers.PhoneNumber} number the phone number to be
2033 i18n.phonenumbers.PhoneNumberUtil.prototype.formatNumberForMobileDialing =
2046 /** @type {i18n.phonenumbers.PhoneNumber} */
2051 /** @type {i18n.phonenumbers.PhoneNumberType} */
2054 var isValidNumber = (numberType != i18n.phonenumbers.PhoneNumberType.UNKNOWN);
2058 (numberType == i18n.phonenumbers.PhoneNumberType.FIXED_LINE) ||
2059 (numberType == i18n.phonenumbers.PhoneNumberType.MOBILE) ||
2060 (numberType == i18n.phonenumbers.PhoneNumberType.FIXED_LINE_OR_MOBILE);
2076 i18n.phonenumbers.PhoneNumberUtil.NANPA_COUNTRY_CODE_) {
2081 /** @type {i18n.phonenumbers.PhoneMetadata} */
2086 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.TOO_SHORT) {
2088 numberNoExt, i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL);
2091 numberNoExt, i18n.phonenumbers.PhoneNumberFormat.NATIONAL);
2098 i18n.phonenumbers.PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY ||
2120 numberNoExt, i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL);
2123 numberNoExt, i18n.phonenumbers.PhoneNumberFormat.NATIONAL);
2132 i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL) :
2133 this.format(numberNoExt, i18n.phonenumbers.PhoneNumberFormat.E164);
2137 i18n.phonenumbers.PhoneNumberUtil.normalizeDiallableCharsOnly(
2158 * @param {i18n.phonenumbers.PhoneNumber} number the phone number to be
2163 i18n.phonenumbers.PhoneNumberUtil.prototype.formatOutOfCountryCallingNumber =
2168 i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL);
2178 i18n.phonenumbers.PhoneNumberUtil.NANPA_COUNTRY_CODE_) {
2183 this.format(number, i18n.phonenumbers.PhoneNumberFormat.NATIONAL);
2196 i18n.phonenumbers.PhoneNumberFormat.NATIONAL);
2199 /** @type {i18n.phonenumbers.PhoneMetadata} */
2214 } else if (i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
2215 i18n.phonenumbers.PhoneNumberUtil.SINGLE_INTERNATIONAL_PREFIX_,
2223 /** @type {i18n.phonenumbers.PhoneMetadata} */
2229 i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL);
2232 metadataForRegion, i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL);
2237 countryCallingCode, i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL,
2254 * @param {i18n.phonenumbers.PhoneNumber} number the phone number that needs to
2260 i18n.phonenumbers.PhoneNumberUtil.prototype.formatInOriginalFormat =
2269 return this.format(number, i18n.phonenumbers.PhoneNumberFormat.NATIONAL);
2274 case i18n.phonenumbers.PhoneNumber.CountryCodeSource
2277 i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL);
2279 case i18n.phonenumbers.PhoneNumber.CountryCodeSource.FROM_NUMBER_WITH_IDD:
2283 case i18n.phonenumbers.PhoneNumber.CountryCodeSource
2286 i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL).substring(1);
2288 case i18n.phonenumbers.PhoneNumber.CountryCodeSource.FROM_DEFAULT_COUNTRY:
2300 this.format(number, i18n.phonenumbers.PhoneNumberFormat.NATIONAL);
2318 /** @type {i18n.phonenumbers.PhoneMetadata} */
2322 /** @type {i18n.phonenumbers.NumberFormat} */
2350 candidateNationalPrefixRule = i18n.phonenumbers.PhoneNumberUtil
2358 /** @type {i18n.phonenumbers.NumberFormat} */
2362 i18n.phonenumbers.PhoneNumberFormat.NATIONAL, [numFormatCopy]);
2373 i18n.phonenumbers.PhoneNumberUtil.normalizeDiallableCharsOnly(
2377 i18n.phonenumbers.PhoneNumberUtil.normalizeDiallableCharsOnly(rawInput);
2395 i18n.phonenumbers.PhoneNumberUtil.prototype.rawInputContainsNationalPrefix_ =
2400 i18n.phonenumbers.PhoneNumberUtil.normalizeDigitsOnly(rawInput);
2420 * @param {i18n.phonenumbers.PhoneNumber} number
2424 i18n.phonenumbers.PhoneNumberUtil.prototype.hasFormattingPatternForNumber_ =
2431 /** @type {i18n.phonenumbers.PhoneMetadata} */
2439 /** @type {i18n.phonenumbers.NumberFormat} */
2467 * @param {i18n.phonenumbers.PhoneNumber} number the phone number that needs to
2472 i18n.phonenumbers.PhoneNumberUtil.prototype.
2490 rawInput = i18n.phonenumbers.PhoneNumberUtil.normalizeHelper_(
2492 i18n.phonenumbers.PhoneNumberUtil.ALL_PLUS_NUMBER_GROUPING_SYMBOLS_,
2508 /** @type {i18n.phonenumbers.PhoneMetadata} */
2511 if (countryCode == i18n.phonenumbers.PhoneNumberUtil.NANPA_COUNTRY_CODE_) {
2517 /** @type {i18n.phonenumbers.NumberFormat} */
2524 /** @type {i18n.phonenumbers.NumberFormat} */
2539 i18n.phonenumbers.PhoneNumberFormat.NATIONAL);
2551 i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
2552 i18n.phonenumbers.PhoneNumberUtil.SINGLE_INTERNATIONAL_PREFIX_,
2560 /** @type {i18n.phonenumbers.PhoneMetadata} */
2566 i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL);
2575 countryCode, i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL,
2585 * @param {i18n.phonenumbers.PhoneNumber} number the phone number for which the
2590 i18n.phonenumbers.PhoneNumberUtil.prototype.getNationalSignificantNumber =
2616 * @param {i18n.phonenumbers.PhoneNumberFormat} numberFormat the format the
2623 i18n.phonenumbers.PhoneNumberUtil.prototype.
2630 case i18n.phonenumbers.PhoneNumberFormat.E164:
2631 return i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN + countryCallingCode +
2633 case i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL:
2634 return i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN + countryCallingCode +
2636 case i18n.phonenumbers.PhoneNumberFormat.RFC3966:
2637 return i18n.phonenumbers.PhoneNumberUtil.RFC3966_PREFIX_ +
2638 i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN + countryCallingCode +
2640 case i18n.phonenumbers.PhoneNumberFormat.NATIONAL:
2655 * @param {i18n.phonenumbers.PhoneMetadata} metadata the metadata for the
2657 * @param {i18n.phonenumbers.PhoneNumberFormat} numberFormat the format the
2663 i18n.phonenumbers.PhoneNumberUtil.prototype.formatNsn_ =
2666 /** @type {Array.<i18n.phonenumbers.NumberFormat>} */
2670 /** @type {Array.<i18n.phonenumbers.NumberFormat>} */
2673 numberFormat == i18n.phonenumbers.PhoneNumberFormat.NATIONAL) ?
2675 /** @type {i18n.phonenumbers.NumberFormat} */
2686 * @param {Array.<i18n.phonenumbers.NumberFormat>} availableFormats the
2690 * @return {i18n.phonenumbers.NumberFormat}
2693 i18n.phonenumbers.PhoneNumberUtil.prototype.chooseFormattingPatternForNumber_ =
2696 /** @type {i18n.phonenumbers.NumberFormat} */
2711 if (i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(patternToMatch,
2727 * @param {i18n.phonenumbers.NumberFormat} formattingPattern the formatting rule
2729 * @param {i18n.phonenumbers.PhoneNumberFormat} numberFormat the format the
2735 i18n.phonenumbers.PhoneNumberUtil.prototype.formatNsnUsingPattern_ =
2747 if (numberFormat == i18n.phonenumbers.PhoneNumberFormat.NATIONAL &&
2753 .replace(i18n.phonenumbers.PhoneNumberUtil.CC_PATTERN_,
2758 i18n.phonenumbers.PhoneNumberUtil.FIRST_GROUP_PATTERN_,
2767 if (numberFormat == i18n.phonenumbers.PhoneNumberFormat.NATIONAL &&
2772 i18n.phonenumbers.PhoneNumberUtil.FIRST_GROUP_PATTERN_,
2779 if (numberFormat == i18n.phonenumbers.PhoneNumberFormat.RFC3966) {
2782 new RegExp('^' + i18n.phonenumbers.PhoneNumberUtil.SEPARATOR_PATTERN_),
2786 new RegExp(i18n.phonenumbers.PhoneNumberUtil.SEPARATOR_PATTERN_, 'g'),
2797 * @return {i18n.phonenumbers.PhoneNumber} a valid fixed-line number for the
2803 i18n.phonenumbers.PhoneNumberUtil.prototype.getExampleNumber =
2807 i18n.phonenumbers.PhoneNumberType.FIXED_LINE);
2815 * @param {i18n.phonenumbers.PhoneNumberType} type the type of number that is
2817 * @return {i18n.phonenumbers.PhoneNumber} a valid number for the specified
2823 i18n.phonenumbers.PhoneNumberUtil.prototype.getExampleNumberForType =
2830 /** @type {i18n.phonenumbers.PhoneNumberDesc} */
2831 var desc = i18n.phonenumbers.PhoneNumberUtil.getNumberDescByType_(
2849 * @return {i18n.phonenumbers.PhoneNumber} a valid number for the
2854 i18n.phonenumbers.PhoneNumberUtil.prototype.getExampleNumberForNonGeoEntity =
2856 /** @type {i18n.phonenumbers.PhoneMetadata} */
2860 /** @type {!i18n.phonenumbers.PhoneNumberDesc|undefined} */
2884 * @param {i18n.phonenumbers.PhoneNumber} number the PhoneNumber that might have
2886 * @param {i18n.phonenumbers.PhoneMetadata} metadata the metadata for the
2888 * @param {i18n.phonenumbers.PhoneNumberFormat} numberFormat the format the
2893 i18n.phonenumbers.PhoneNumberUtil.prototype.maybeGetFormattedExtension_ =
2899 if (numberFormat == i18n.phonenumbers.PhoneNumberFormat.RFC3966) {
2900 return i18n.phonenumbers.PhoneNumberUtil.RFC3966_EXTN_PREFIX_ +
2907 return i18n.phonenumbers.PhoneNumberUtil.DEFAULT_EXTN_PREFIX_ +
2916 * @param {i18n.phonenumbers.PhoneMetadata} metadata
2917 * @param {i18n.phonenumbers.PhoneNumberType} type
2918 * @return {i18n.phonenumbers.PhoneNumberDesc}
2921 i18n.phonenumbers.PhoneNumberUtil.getNumberDescByType_ =
2925 case i18n.phonenumbers.PhoneNumberType.PREMIUM_RATE:
2927 case i18n.phonenumbers.PhoneNumberType.TOLL_FREE:
2929 case i18n.phonenumbers.PhoneNumberType.MOBILE:
2931 case i18n.phonenumbers.PhoneNumberType.FIXED_LINE:
2932 case i18n.phonenumbers.PhoneNumberType.FIXED_LINE_OR_MOBILE:
2934 case i18n.phonenumbers.PhoneNumberType.SHARED_COST:
2936 case i18n.phonenumbers.PhoneNumberType.VOIP:
2938 case i18n.phonenumbers.PhoneNumberType.PERSONAL_NUMBER:
2940 case i18n.phonenumbers.PhoneNumberType.PAGER:
2942 case i18n.phonenumbers.PhoneNumberType.UAN:
2944 case i18n.phonenumbers.PhoneNumberType.VOICEMAIL:
2955 * @param {i18n.phonenumbers.PhoneNumber} number the phone number that we want
2957 * @return {i18n.phonenumbers.PhoneNumberType} the type of the phone number, or
2960 i18n.phonenumbers.PhoneNumberUtil.prototype.getNumberType =
2965 /** @type {i18n.phonenumbers.PhoneMetadata} */
2969 return i18n.phonenumbers.PhoneNumberType.UNKNOWN;
2979 * @param {i18n.phonenumbers.PhoneMetadata} metadata
2980 * @return {i18n.phonenumbers.PhoneNumberType}
2983 i18n.phonenumbers.PhoneNumberUtil.prototype.getNumberTypeHelper_ =
2987 return i18n.phonenumbers.PhoneNumberType.UNKNOWN;
2991 return i18n.phonenumbers.PhoneNumberType.PREMIUM_RATE;
2994 return i18n.phonenumbers.PhoneNumberType.TOLL_FREE;
2997 return i18n.phonenumbers.PhoneNumberType.SHARED_COST;
3000 return i18n.phonenumbers.PhoneNumberType.VOIP;
3004 return i18n.phonenumbers.PhoneNumberType.PERSONAL_NUMBER;
3007 return i18n.phonenumbers.PhoneNumberType.PAGER;
3010 return i18n.phonenumbers.PhoneNumberType.UAN;
3013 return i18n.phonenumbers.PhoneNumberType.VOICEMAIL;
3021 return i18n.phonenumbers.PhoneNumberType.FIXED_LINE_OR_MOBILE;
3024 return i18n.phonenumbers.PhoneNumberType.FIXED_LINE_OR_MOBILE;
3026 return i18n.phonenumbers.PhoneNumberType.FIXED_LINE;
3032 return i18n.phonenumbers.PhoneNumberType.MOBILE;
3034 return i18n.phonenumbers.PhoneNumberType.UNKNOWN;
3043 * @return {?i18n.phonenumbers.PhoneMetadata}
3045 i18n.phonenumbers.PhoneNumberUtil.prototype.getMetadataForRegion =
3052 /** @type {i18n.phonenumbers.PhoneMetadata} */
3059 i18n.phonenumbers.metadata.countryToMetadata[regionCode];
3063 metadata = /** @type {i18n.phonenumbers.PhoneMetadata} */ (
3064 serializer.deserialize(i18n.phonenumbers.PhoneMetadata.getDescriptor(),
3074 * @return {?i18n.phonenumbers.PhoneMetadata}
3076 i18n.phonenumbers.PhoneNumberUtil.prototype.
3085 * @param {i18n.phonenumbers.PhoneNumberDesc} numberDesc
3089 i18n.phonenumbers.PhoneNumberUtil.prototype.isNumberMatchingDesc_ =
3100 return i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
3116 * @param {!i18n.phonenumbers.PhoneNumber} number the phone number that we want
3121 i18n.phonenumbers.PhoneNumberUtil.prototype.isValidNumber = function(number) {
3141 * @param {!i18n.phonenumbers.PhoneNumber} number the phone number that we want
3148 i18n.phonenumbers.PhoneNumberUtil.prototype.isValidNumberForRegion =
3153 /** @type {i18n.phonenumbers.PhoneMetadata} */
3157 (i18n.phonenumbers.PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY !=
3168 i18n.phonenumbers.PhoneNumberType.UNKNOWN;
3177 * @param {?i18n.phonenumbers.PhoneNumber} number the phone number whose origin
3182 i18n.phonenumbers.PhoneNumberUtil.prototype.getRegionCodeForNumber =
3192 i18n.phonenumbers.metadata.countryCodeToRegionCodeMap[countryCode];
3205 * @param {!i18n.phonenumbers.PhoneNumber} number
3210 i18n.phonenumbers.PhoneNumberUtil.prototype.
3224 /** @type {i18n.phonenumbers.PhoneMetadata} */
3231 i18n.phonenumbers.PhoneNumberType.UNKNOWN) {
3248 i18n.phonenumbers.PhoneNumberUtil.prototype.getRegionCodeForCountryCode =
3253 i18n.phonenumbers.metadata.countryCodeToRegionCodeMap[countryCallingCode];
3255 i18n.phonenumbers.PhoneNumberUtil.UNKNOWN_REGION_ : regionCodes[0];
3268 i18n.phonenumbers.PhoneNumberUtil.prototype.getRegionCodesForCountryCode =
3273 i18n.phonenumbers.metadata.countryCodeToRegionCodeMap[countryCallingCode];
3287 i18n.phonenumbers.PhoneNumberUtil.prototype.getCountryCodeForRegion =
3309 i18n.phonenumbers.PhoneNumberUtil.prototype.getCountryCodeForValidRegion_ =
3312 /** @type {i18n.phonenumbers.PhoneMetadata} */
3340 i18n.phonenumbers.PhoneNumberUtil.prototype.getNddPrefixForRegion = function(
3342 /** @type {i18n.phonenumbers.PhoneMetadata} */
3369 i18n.phonenumbers.PhoneNumberUtil.prototype.isNANPACountry = function(
3372 i18n.phonenumbers.metadata
3373 .countryCodeToRegionCodeMap[i18n.phonenumbers.PhoneNumberUtil
3390 i18n.phonenumbers.PhoneNumberUtil.prototype.isAlphaNumber = function(number) {
3391 if (!i18n.phonenumbers.PhoneNumberUtil.isViablePhoneNumber(number)) {
3398 return i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
3399 i18n.phonenumbers.PhoneNumberUtil.VALID_ALPHA_PHONE_PATTERN_,
3414 * @param {i18n.phonenumbers.PhoneNumber} number the number that needs to be
3418 i18n.phonenumbers.PhoneNumberUtil.prototype.isPossibleNumber =
3420 /** @type {!i18n.phonenumbers.PhoneNumberUtil.ValidationResult} */
3423 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE ||
3425 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE_LOCAL_ONLY;
3439 * @param {i18n.phonenumbers.PhoneNumber} number the number that needs to be
3441 * @param {i18n.phonenumbers.PhoneNumberType} type the type we are interested in
3444 i18n.phonenumbers.PhoneNumberUtil.prototype.isPossibleNumberForType =
3446 /** @type {!i18n.phonenumbers.PhoneNumberUtil.ValidationResult} */
3449 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE ||
3451 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE_LOCAL_ONLY;
3461 * @param {i18n.phonenumbers.PhoneMetadata} metadata
3462 * @return {i18n.phonenumbers.PhoneNumberUtil.ValidationResult}
3465 i18n.phonenumbers.PhoneNumberUtil.prototype.testNumberLength_ =
3468 number, metadata, i18n.phonenumbers.PhoneNumberType.UNKNOWN);
3477 * @param {i18n.phonenumbers.PhoneMetadata} metadata
3478 * @param {i18n.phonenumbers.PhoneNumberType} type
3479 * @return {i18n.phonenumbers.PhoneNumberUtil.ValidationResult}
3482 i18n.phonenumbers.PhoneNumberUtil.prototype.testNumberLengthForType_ =
3485 i18n.phonenumbers.PhoneNumberUtil.getNumberDescByType_(metadata, type);
3499 if (type == i18n.phonenumbers.PhoneNumberType.FIXED_LINE_OR_MOBILE) {
3500 if (!i18n.phonenumbers.PhoneNumberUtil.descHasPossibleNumberData_(
3501 i18n.phonenumbers.PhoneNumberUtil.getNumberDescByType_(
3502 metadata, i18n.phonenumbers.PhoneNumberType.FIXED_LINE))) {
3507 number, metadata, i18n.phonenumbers.PhoneNumberType.MOBILE);
3509 var mobileDesc = i18n.phonenumbers.PhoneNumberUtil.getNumberDescByType_(
3510 metadata, i18n.phonenumbers.PhoneNumberType.MOBILE);
3511 if (i18n.phonenumbers.PhoneNumberUtil.descHasPossibleNumberData_(
3542 return i18n.phonenumbers.PhoneNumberUtil.ValidationResult.INVALID_LENGTH;
3549 return i18n.phonenumbers.PhoneNumberUtil.ValidationResult
3554 return i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE;
3556 return i18n.phonenumbers.PhoneNumberUtil.ValidationResult.TOO_SHORT;
3558 return i18n.phonenumbers.PhoneNumberUtil.ValidationResult.TOO_LONG;
3562 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE :
3563 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.INVALID_LENGTH;
3587 * @param {i18n.phonenumbers.PhoneNumber} number the number that needs to be
3589 * @return {i18n.phonenumbers.PhoneNumberUtil.ValidationResult} a
3592 i18n.phonenumbers.PhoneNumberUtil.prototype.isPossibleNumberWithReason =
3595 number, i18n.phonenumbers.PhoneNumberType.UNKNOWN);
3616 * @param {i18n.phonenumbers.PhoneNumber} number the number that needs to be
3618 * @param {i18n.phonenumbers.PhoneNumberType} type the type we are interested in
3619 * @return {i18n.phonenumbers.PhoneNumberUtil.ValidationResult} a
3622 i18n.phonenumbers.PhoneNumberUtil.prototype.isPossibleNumberForTypeWithReason =
3638 return i18n.phonenumbers.PhoneNumberUtil.ValidationResult
3644 /** @type {i18n.phonenumbers.PhoneMetadata} */
3674 i18n.phonenumbers.PhoneNumberUtil.prototype.isPossibleNumberString =
3690 * @param {!i18n.phonenumbers.PhoneNumber} number a PhoneNumber object which
3694 i18n.phonenumbers.PhoneNumberUtil.prototype.truncateTooLongNumber =
3700 /** @type {i18n.phonenumbers.PhoneNumber} */
3709 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.TOO_SHORT) {
3728 i18n.phonenumbers.PhoneNumberUtil.prototype.extractCountryCode =
3742 i <= i18n.phonenumbers.PhoneNumberUtil.MAX_LENGTH_COUNTRY_CODE_ &&
3746 i18n.phonenumbers.metadata.countryCodeToRegionCodeMap) {
3773 * It will throw a i18n.phonenumbers.Error if the number starts with a '+' but
3779 * @param {i18n.phonenumbers.PhoneMetadata} defaultRegionMetadata metadata
3787 * @param {i18n.phonenumbers.PhoneNumber} phoneNumber the PhoneNumber object
3795 i18n.phonenumbers.PhoneNumberUtil.prototype.maybeExtractCountryCode =
3814 /** @type {i18n.phonenumbers.PhoneNumber.CountryCodeSource} */
3821 i18n.phonenumbers.PhoneNumber.CountryCodeSource.FROM_DEFAULT_COUNTRY) {
3823 i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_FOR_NSN_) {
3824 throw new Error(i18n.phonenumbers.Error.TOO_SHORT_AFTER_IDD);
3836 throw new Error(i18n.phonenumbers.Error.INVALID_COUNTRY_CODE);
3851 /** @type {i18n.phonenumbers.PhoneNumberDesc} */
3864 if ((!i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
3866 i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
3870 i18n.phonenumbers.PhoneNumberUtil.ValidationResult.TOO_LONG) {
3874 i18n.phonenumbers.PhoneNumber.CountryCodeSource
3899 i18n.phonenumbers.PhoneNumberUtil.prototype.parsePrefixAsIdd_ =
3909 i18n.phonenumbers.PhoneNumberUtil.CAPTURING_DIGIT_PATTERN);
3914 i18n.phonenumbers.PhoneNumberUtil.normalizeDigitsOnly(
3937 * @return {i18n.phonenumbers.PhoneNumber.CountryCodeSource} the corresponding
3942 i18n.phonenumbers.PhoneNumberUtil.prototype.
3948 return i18n.phonenumbers.PhoneNumber.CountryCodeSource.FROM_DEFAULT_COUNTRY;
3951 if (i18n.phonenumbers.PhoneNumberUtil.LEADING_PLUS_CHARS_PATTERN
3954 i18n.phonenumbers.PhoneNumberUtil.LEADING_PLUS_CHARS_PATTERN, '');
3958 number.append(i18n.phonenumbers.PhoneNumberUtil.normalize(numberStr));
3959 return i18n.phonenumbers.PhoneNumber.CountryCodeSource
3965 i18n.phonenumbers.PhoneNumberUtil.normalizeSB_(number);
3967 i18n.phonenumbers.PhoneNumber.CountryCodeSource.FROM_NUMBER_WITH_IDD :
3968 i18n.phonenumbers.PhoneNumber.CountryCodeSource.FROM_DEFAULT_COUNTRY;
3977 * @param {i18n.phonenumbers.PhoneMetadata} metadata the metadata for the
3984 i18n.phonenumbers.PhoneNumberUtil.prototype.
4010 i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
4027 !i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
4046 !i18n.phonenumbers.PhoneNumberUtil.matchesEntirely(
4070 i18n.phonenumbers.PhoneNumberUtil.prototype.maybeStripExtension =
4077 numberStr.search(i18n.phonenumbers.PhoneNumberUtil.EXTN_PATTERN_);
4080 if (mStart >= 0 && i18n.phonenumbers.PhoneNumberUtil.isViablePhoneNumber(
4085 numberStr.match(i18n.phonenumbers.PhoneNumberUtil.EXTN_PATTERN_);
4113 i18n.phonenumbers.PhoneNumberUtil.prototype.checkRegionForParsing_ = function(
4118 i18n.phonenumbers.PhoneNumberUtil.LEADING_PLUS_CHARS_PATTERN.test(
4140 * This method will throw a {@link i18n.phonenumbers.Error} if the number is not
4154 * @return {!i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
4161 i18n.phonenumbers.PhoneNumberUtil.prototype.parse = function(numberToParse,
4179 * @return {!i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
4184 i18n.phonenumbers.PhoneNumberUtil.prototype.parseAndKeepRawInput =
4189 i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN) {
4190 throw new Error(i18n.phonenumbers.Error.INVALID_COUNTRY_CODE);
4202 * @param {i18n.phonenumbers.PhoneNumber} phoneNumber a phone number proto
4206 i18n.phonenumbers.PhoneNumberUtil.setItalianLeadingZerosForPhoneNumber_ =
4244 * @return {!i18n.phonenumbers.PhoneNumber} a phone number proto buffer filled
4249 i18n.phonenumbers.PhoneNumberUtil.prototype.parseHelper_ =
4253 throw new Error(i18n.phonenumbers.Error.NOT_A_NUMBER);
4255 i18n.phonenumbers.PhoneNumberUtil.MAX_INPUT_STRING_LENGTH_) {
4256 throw new Error(i18n.phonenumbers.Error.TOO_LONG);
4263 if (!i18n.phonenumbers.PhoneNumberUtil.isViablePhoneNumber(
4265 throw new Error(i18n.phonenumbers.Error.NOT_A_NUMBER);
4272 throw new Error(i18n.phonenumbers.Error.INVALID_COUNTRY_CODE);
4275 /** @type {i18n.phonenumbers.PhoneNumber} */
4276 var phoneNumber = new i18n.phonenumbers.PhoneNumber();
4288 /** @type {i18n.phonenumbers.PhoneMetadata} */
4302 if (e.message == i18n.phonenumbers.Error.INVALID_COUNTRY_CODE &&
4303 i18n.phonenumbers.PhoneNumberUtil.LEADING_PLUS_CHARS_PATTERN
4307 i18n.phonenumbers.PhoneNumberUtil.LEADING_PLUS_CHARS_PATTERN, '');
4329 i18n.phonenumbers.PhoneNumberUtil.normalizeSB_(nationalNumber);
4339 i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_FOR_NSN_) {
4340 throw new Error(i18n.phonenumbers.Error.TOO_SHORT_NSN);
4357 var validationResults = i18n.phonenumbers.PhoneNumberUtil.ValidationResult;
4372 i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_FOR_NSN_) {
4373 throw new Error(i18n.phonenumbers.Error.TOO_SHORT_NSN);
4376 i18n.phonenumbers.PhoneNumberUtil.MAX_LENGTH_FOR_NSN_) {
4377 throw new Error(i18n.phonenumbers.Error.TOO_LONG);
4379 i18n.phonenumbers.PhoneNumberUtil.setItalianLeadingZerosForPhoneNumber_(
4394 i18n.phonenumbers.PhoneNumberUtil.prototype.extractPhoneContext_ =
4398 .phonenumbers.PhoneNumberUtil.RFC3966_PHONE_CONTEXT_);
4406 .phonenumbers.PhoneNumberUtil.RFC3966_PHONE_CONTEXT_.length;
4432 i18n.phonenumbers.PhoneNumberUtil.prototype.isPhoneContextValid_ =
4443 i18n.phonenumbers.PhoneNumberUtil.RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.exec(
4446 i18n.phonenumbers.PhoneNumberUtil.RFC3966_DOMAINNAME_PATTERN_.exec(
4467 i18n.phonenumbers.PhoneNumberUtil.prototype.buildNationalNumberForParsing_ =
4470 i18n.phonenumbers.PhoneNumberUtil.prototype.extractPhoneContext_(
4473 if (!i18n.phonenumbers.PhoneNumberUtil.prototype.isPhoneContextValid_(
4475 throw new Error(i18n.phonenumbers.Error.NOT_A_NUMBER);
4481 i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN) {
4491 i18n.phonenumbers.PhoneNumberUtil.RFC3966_PREFIX_);
4494 i18n.phonenumbers.PhoneNumberUtil.RFC3966_PREFIX_.length : 0;
4496 i18n.phonenumbers.PhoneNumberUtil.RFC3966_PHONE_CONTEXT_);
4503 i18n.phonenumbers.PhoneNumberUtil.extractPossibleNumber(
4513 i18n.phonenumbers.PhoneNumberUtil.RFC3966_ISDN_SUBADDRESS_);
4533 * @param {i18n.phonenumbers.PhoneNumber} numberIn number that we want to copy
4535 * @return {!i18n.phonenumbers.PhoneNumber} number with core fields only.
4538 i18n.phonenumbers.PhoneNumberUtil.copyCoreFieldsOnly_ = function(numberIn) {
4539 /** @type {i18n.phonenumbers.PhoneNumber} */
4540 var phoneNumber = new i18n.phonenumbers.PhoneNumber();
4569 * @param {i18n.phonenumbers.PhoneNumber|string} firstNumberIn first number to
4572 * @param {i18n.phonenumbers.PhoneNumber|string} secondNumberIn second number to
4575 * @return {i18n.phonenumbers.PhoneNumberUtil.MatchType} NOT_A_NUMBER, NO_MATCH,
4579 i18n.phonenumbers.PhoneNumberUtil.prototype.isNumberMatch =
4585 /** @type {i18n.phonenumbers.PhoneNumber} */
4587 /** @type {i18n.phonenumbers.PhoneNumber} */
4594 firstNumberIn, i18n.phonenumbers.PhoneNumberUtil.UNKNOWN_REGION_);
4596 if (e.message != i18n.phonenumbers.Error.INVALID_COUNTRY_CODE) {
4597 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NOT_A_NUMBER;
4608 i18n.phonenumbers.PhoneNumberUtil.UNKNOWN_REGION_) {
4612 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NOT_A_NUMBER;
4614 /** @type {i18n.phonenumbers.PhoneNumberUtil.MatchType} */
4617 i18n.phonenumbers.PhoneNumberUtil.MatchType.EXACT_MATCH) {
4618 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NSN_MATCH;
4628 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NOT_A_NUMBER;
4637 secondNumberIn, i18n.phonenumbers.PhoneNumberUtil.UNKNOWN_REGION_);
4640 if (e.message != i18n.phonenumbers.Error.INVALID_COUNTRY_CODE) {
4641 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NOT_A_NUMBER;
4649 i18n.phonenumbers.PhoneNumberUtil.copyCoreFieldsOnly_(firstNumber);
4651 i18n.phonenumbers.PhoneNumberUtil.copyCoreFieldsOnly_(secondNumber);
4658 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NO_MATCH;
4667 return i18n.phonenumbers.PhoneNumberUtil.MatchType.EXACT_MATCH;
4675 return i18n.phonenumbers.PhoneNumberUtil.MatchType.SHORT_NSN_MATCH;
4678 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NO_MATCH;
4687 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NSN_MATCH;
4691 return i18n.phonenumbers.PhoneNumberUtil.MatchType.SHORT_NSN_MATCH;
4693 return i18n.phonenumbers.PhoneNumberUtil.MatchType.NO_MATCH;
4701 * @param {i18n.phonenumbers.PhoneNumber} firstNumber the first PhoneNumber
4703 * @param {i18n.phonenumbers.PhoneNumber} secondNumber the second PhoneNumber
4708 i18n.phonenumbers.PhoneNumberUtil.prototype.isNationalNumberSuffixOfTheOther_ =
4730 * @param {i18n.phonenumbers.PhoneNumber} number the phone-number for which we
4735 i18n.phonenumbers.PhoneNumberUtil.prototype.canBeInternationallyDialled =
4737 /** @type {i18n.phonenumbers.PhoneMetadata} */
4760 i18n.phonenumbers.PhoneNumberUtil.matchesEntirely = function(regex, str) {
4781 i18n.phonenumbers.PhoneNumberUtil.matchesPrefix = function(regex, str) {