PATH:
opt
/
bitninja-dispatcher
/
node_modules
/
libphonenumber-js
/
source
export default class AsYouTypeState { constructor({ onCountryChange, onCallingCodeChange }) { this.onCountryChange = onCountryChange this.onCallingCodeChange = onCallingCodeChange } reset(defaultCountry, defaultCallingCode) { this.international = false this.IDDPrefix = undefined this.missingPlus = undefined this.callingCode = undefined this.digits = '' this.resetNationalSignificantNumber() this.initCountryAndCallingCode(defaultCountry, defaultCallingCode) } resetNationalSignificantNumber() { this.nationalSignificantNumber = this.getNationalDigits() this.nationalSignificantNumberMatchesInput = true this.nationalPrefix = undefined this.carrierCode = undefined this.complexPrefixBeforeNationalSignificantNumber = undefined } update(properties) { for (const key of Object.keys(properties)) { this[key] = properties[key] } } initCountryAndCallingCode(country, callingCode) { this.setCountry(country) this.setCallingCode(callingCode) } setCountry(country) { this.country = country this.onCountryChange(country) } setCallingCode(callingCode) { this.callingCode = callingCode this.onCallingCodeChange(callingCode, this.country) } startInternationalNumber(country, callingCode) { // Prepend the `+` to parsed input. this.international = true // If a default country was set then reset it // because an explicitly international phone // number is being entered. this.initCountryAndCallingCode(country, callingCode) } appendDigits(nextDigits) { this.digits += nextDigits } appendNationalSignificantNumberDigits(nextDigits) { this.nationalSignificantNumber += nextDigits } /** * Returns the part of `this.digits` that corresponds to the national number. * Basically, all digits that have been input by the user, except for the * international prefix and the country calling code part * (if the number is an international one). * @return {string} */ getNationalDigits() { if (this.international) { return this.digits.slice( (this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0) ) } return this.digits } getDigitsWithoutInternationalPrefix() { if (this.international) { if (this.IDDPrefix) { return this.digits.slice(this.IDDPrefix.length) } } return this.digits } }
[-] parsePhoneNumberFromString.test.js
[edit]
[-] metadata.js
[edit]
[-] PhoneNumber.js
[edit]
[-] AsYouTypeFormatter.PatternMatcher.d.ts
[edit]
[-] parsePhoneNumber.js
[edit]
[-] isPossiblePhoneNumber.test.js
[edit]
[-] findNumbers.js
[edit]
[-] isPossibleNumber.js
[edit]
[-] getNumberType.js
[edit]
[-] AsYouTypeFormatter.PatternMatcher.js
[edit]
[-] parse_.js
[edit]
[-] getExampleNumber.test.js
[edit]
[-] AsYouTypeParser.js
[edit]
[+]
..
[-] validate_.js
[edit]
[-] parsePhoneNumberFromString_.js
[edit]
[-] AsYouTypeFormatter.PatternParser.d.ts
[edit]
[-] searchPhoneNumbersInText.test.js
[edit]
[-] getCountries.test.js
[edit]
[-] searchPhoneNumbersInText.js
[edit]
[-] AsYouTypeFormatter.PatternParser.test.js
[edit]
[-] formatNumberForMobileDialing.js
[edit]
[-] getCountryCallingCode.js
[edit]
[-] findPhoneNumbers.test.js
[edit]
[-] parsePhoneNumber.test.js
[edit]
[-] isValidPhoneNumber.test.js
[edit]
[-] AsYouType.test.js
[edit]
[-] getCountries.js
[edit]
[-] validate.test.js
[edit]
[-] AsYouTypeFormatter.js
[edit]
[-] PhoneNumberMatcher.js
[edit]
[-] findNumbers_.js
[edit]
[-] formatIncompletePhoneNumber.test.js
[edit]
[-] format.test.js
[edit]
[-] findPhoneNumbers.js
[edit]
[-] searchNumbers.js
[edit]
[-] findPhoneNumbersInText.js
[edit]
[-] findPhoneNumbersInText.test.js
[edit]
[-] metadata.test.js
[edit]
[-] parse.js
[edit]
[-] validatePhoneNumberLength.test.js
[edit]
[-] findNumbers.test.js
[edit]
[+]
tools
[-] parsePhoneNumberFromString.js
[edit]
[-] getCountryCallingCode.test.js
[edit]
[-] isPossibleNumber.test.js
[edit]
[-] parse.test.js
[edit]
[-] parsePhoneNumber_.js
[edit]
[-] ParseError.js
[edit]
[-] PhoneNumber.test.js
[edit]
[-] AsYouTypeFormatter.PatternMatcher.test.js
[edit]
[-] getNumberType.test.js
[edit]
[-] AsYouTypeFormatter.PatternParser.js
[edit]
[-] validatePhoneNumberLength.js
[edit]
[-] isValidPhoneNumber.js
[edit]
[+]
helpers
[-] parseIncompletePhoneNumber.test.js
[edit]
[-] formatNumberForMobileDialing.test.js
[edit]
[-] isValidNumberForRegion_.js
[edit]
[-] PhoneNumberMatcher.test.js
[edit]
[-] isPossibleNumber_.js
[edit]
[-] AsYouTypeFormatter.util.js
[edit]
[-] format.js
[edit]
[-] isValidNumberForRegion.test.js
[edit]
[-] AsYouType.js
[edit]
[-] AsYouTypeFormatter.complete.js
[edit]
[+]
findNumbers
[-] getExampleNumber.js
[edit]
[-] format_.js
[edit]
[-] isPossiblePhoneNumber.js
[edit]
[-] findPhoneNumbers_.js
[edit]
[-] isValidNumberForRegion.js
[edit]
[-] validate.js
[edit]
[-] AsYouTypeState.js
[edit]
[-] formatIncompletePhoneNumber.js
[edit]
[-] constants.js
[edit]
[-] parseIncompletePhoneNumber.js
[edit]
[-] searchNumbers.test.js
[edit]
[-] AsYouTypeFormatter.util.test.js
[edit]