Lines Matching refs:number

49    * A mapping from region code to the short-number metadata for that region.
58 * In these countries, if extra digits are added to an emergency number, it no
73 * @enum {number} Cost categories of short numbers.
88 * @param {number} countryCallingCode
101 * Helper method to check that the country calling code of the number matches
103 * @param {i18n.phonenumbers.PhoneNumber} number
109 function(number, regionDialingFrom) {
111 number.getCountryCodeOrDefault());
117 * Check whether a short number is a possible number when dialed from the given
121 * @param {i18n.phonenumbers.PhoneNumber} number the short number to check
122 * @param {string} regionDialingFrom the region from which the number is dialed
123 * @return {boolean} whether the number is a possible short number
126 function(number, regionDialingFrom) {
127 if (!this.regionDialingFromMatchesNumber_(number, regionDialingFrom)) {
134 var numberLength = this.getNationalSignificantNumber_(number).length;
141 * Check whether a short number is a possible number. If a country calling code
146 * @param {i18n.phonenumbers.PhoneNumber} number the short number to check
147 * @return {boolean} whether the number is a possible short number
150 function(number) {
152 number.getCountryCodeOrDefault());
153 var shortNumberLength = this.getNationalSignificantNumber_(number).length;
170 * Tests whether a short number matches a valid pattern in a region. Note that
171 * this doesn't verify the number is actually in use, which is impossible to
172 * tell by just looking at the number itself.
174 * @param {i18n.phonenumbers.PhoneNumber} number the short number for which we
176 * @param {?string} regionDialingFrom the region from which the number is dialed
177 * @return {boolean} whether the short number matches a valid pattern
180 function(number, regionDialingFrom) {
181 if (!this.regionDialingFromMatchesNumber_(number, regionDialingFrom)) {
188 var shortNumber = this.getNationalSignificantNumber_(number);
200 * Tests whether a short number matches a valid pattern. If a country calling
202 * them. Note that this doesn't verify the number is actually in use, which is
203 * impossible to tell by just looking at the number itself. See
206 * @param {i18n.phonenumbers.PhoneNumber} number the short number for which we
208 * @return {boolean} whether the short number matches a valid pattern
211 function(number) {
213 number.getCountryCodeOrDefault());
214 var regionCode = this.getRegionCodeForShortNumberFromRegionList_(number,
217 // If a matching region had been found for the phone number from among two
222 return this.isValidShortNumberForRegion(number, regionCode);
227 * Gets the expected cost category of a short number when dialed from a region
229 * number is valid, then its validity must first be checked using
233 * // The region for which the number was parsed and the region we subsequently
234 * // check against need not be the same. Here we parse the number in the US and
236 * PhoneNumber number = phoneUtil.parse("110", "US");
241 * ShortNumberCost cost = shortInfo.getExpectedCostForRegion(number,
246 * @param {i18n.phonenumbers.PhoneNumber} number the short number for which we
248 * @param {string} regionDialingFrom the region from which the number is dialed
250 * category for that region of the short number. Returns UNKNOWN_COST if the
251 * number does not match a cost category. Note that an invalid number may
257 function(number, regionDialingFrom) {
259 if (!this.regionDialingFromMatchesNumber_(number, regionDialingFrom)) {
266 var shortNumber = this.getNationalSignificantNumber_(number);
293 * Gets the expected cost category of a short number (however, nothing is
300 * if a number is UNKNOWN_COST in one region but STANDARD_RATE or TOLL_FREE in
302 * might be a PREMIUM_RATE number.
304 * For example, if a number is STANDARD_RATE in the US, but TOLL_FREE in Canada,
308 * Note: If the region from which the number is dialed is known, it is highly
312 * @param {i18n.phonenumbers.PhoneNumber} number the short number for which we
315 * expected cost category of the short number in the region(s) with the
320 i18n.phonenumbers.ShortNumberInfo.prototype.getExpectedCost = function(number) {
323 number.getCountryCodeOrDefault());
328 return this.getExpectedCostForRegion(number, regionCodes[0]);
333 var costForRegion = this.getExpectedCostForRegion(number, regionCode);
357 * Helper method to get the region code for a given phone number, from a list
359 * first region for which the number is valid is returned.
360 * @param {!i18n.phonenumbers.PhoneNumber} number
366 function(number, regionCodes) {
372 var nationalNumber = this.getNationalSignificantNumber_(number);
399 * Gets a valid short number for the specified region.
401 * @param {?string} regionCode the region for which an example short number is
403 * @return {string} a valid short number for the specified region. Returns an
422 * Gets a valid short number for the specified cost category.
424 * @param {string} regionCode the region for which an example short number is
427 * category of number that is needed
428 * @return {string} a valid short number for the specified region and cost
462 * Returns true if the given number, exactly as dialed, might be used to
468 * method takes into account cases where the number might contain formatting,
472 * @param {string} number the phone number to test
473 * @param {string} regionCode the region where the phone number is being
475 * @return {boolean} whether the number might be used to connect to an
479 function(number, regionCode) {
480 return this.matchesEmergencyNumberHelper_(number, regionCode,
486 * Returns true if the given number exactly matches an emergency service
487 * number in the given region.
489 * This method takes into account cases where the number might contain
491 * {@code isEmergencyNumber(number, region)} implies
492 * {@code connectsToEmergencyNumber(number, region)}.
494 * @param {string} number the phone number to test
495 * @param {string} regionCode the region where the phone number is being
497 * @return {boolean} whether the number exactly matches an emergency services
498 * number in the given region.
501 function(number, regionCode) {
502 return this.matchesEmergencyNumberHelper_(number, regionCode,
538 * @param {string} number the number to match against
541 * @return {boolean} True iff the number matches an emergency number for that
546 function(number, regionCode, allowPrefixMatch) {
548 .extractPossibleNumber(number);
575 * Given a valid short number, determines whether it is carrier-specific
578 * the user's carrier. If it is important that the number is valid, then its
582 * @param {i18n.phonenumbers.PhoneNumber} number the valid short number to
584 * @return {boolean} whether the short number is carrier-specific, assuming the
585 * input was a valid short number
588 function(number) {
590 number.getCountryCodeOrDefault());
591 var regionCode = this.getRegionCodeForShortNumberFromRegionList_(number,
593 var nationalNumber = this.getNationalSignificantNumber_(number);
601 * Given a valid short number, determines whether it is carrier-specific when
605 * the number is valid, then its validity must first be checked using
607 * false if the number doesn't match the region provided.
609 * @param {i18n.phonenumbers.PhoneNumber} number the valid short number to
611 * @param {string} regionDialingFrom the region from which the number is dialed
612 * @return {boolean} whether the short number is carrier-specific in the
613 * provided region, assuming the input was a valid short number
616 function(number, regionDialingFrom) {
617 if (!this.regionDialingFromMatchesNumber_(number, regionDialingFrom)) {
620 var nationalNumber = this.getNationalSignificantNumber_(number);
628 * Given a valid short number, determines whether it is an SMS service
632 * isn't MMS-capable. If it is important that the number is valid, then its
634 * #isValidShortNumberForRegion}. Returns false if the number doesn't match the
637 * @param {i18n.phonenumbers.PhoneNumber} number the valid short number to
639 * @param {string} regionDialingFrom the region from which the number is dialed
640 * @return {boolean} whether the short number is an SMS service in the provided
641 * region, assuming the input was a valid short number
644 function(number, regionDialingFrom) {
645 if (!this.regionDialingFromMatchesNumber_(number, regionDialingFrom)) {
649 var nationalNumber = this.getNationalSignificantNumber_(number);
656 * Gets the national significant number of a phone number. Note a national
657 * significant number doesn't contain a national prefix or any formatting.
664 * @param {i18n.phonenumbers.PhoneNumber} number the phone number for which the
665 * national significant number is needed.
666 * @return {string} the national significant number of the PhoneNumber object
671 function(number) {
672 if (!number.hasNationalNumber()) {
676 var nationalNumber = '' + number.getNationalNumber();
682 if (number.hasItalianLeadingZero() && number.getItalianLeadingZero() &&
683 number.getNumberOfLeadingZerosOrDefault() > 0) {
684 return Array(number.getNumberOfLeadingZerosOrDefault() + 1).join('0') +
695 * @param {string} number
701 .matchesPossibleNumberAndNationalNumber_ = function(number, numberDesc) {
703 !numberDesc.possibleLengthArray().includes(number.length)) {
707 numberDesc.getNationalNumberPatternOrDefault(), number.toString());