Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../uploads/../../../../instantly.picotech.app/homes/../../wa.picotech.app/public_html/node_modules/path-exists/../duplexify/./../@protobufjs/../cheerio/.././cliui/../curve25519-js/../libphonenumber-js/es6/helpers/..
الملفات الموجودة في هذا الـ Path:
.
..
AsYouType.js
AsYouType.js.map
AsYouType.test.js
AsYouType.test.js.map
AsYouTypeFormatter.PatternMatcher.js
AsYouTypeFormatter.PatternMatcher.js.map
AsYouTypeFormatter.PatternMatcher.test.js
AsYouTypeFormatter.PatternMatcher.test.js.map
AsYouTypeFormatter.PatternParser.js
AsYouTypeFormatter.PatternParser.js.map
AsYouTypeFormatter.PatternParser.test.js
AsYouTypeFormatter.PatternParser.test.js.map
AsYouTypeFormatter.complete.js
AsYouTypeFormatter.complete.js.map
AsYouTypeFormatter.js
AsYouTypeFormatter.js.map
AsYouTypeFormatter.util.js
AsYouTypeFormatter.util.js.map
AsYouTypeFormatter.util.test.js
AsYouTypeFormatter.util.test.js.map
AsYouTypeParser.js
AsYouTypeParser.js.map
AsYouTypeState.js
AsYouTypeState.js.map
ParseError.js
ParseError.js.map
PhoneNumber.js
PhoneNumber.js.map
PhoneNumber.test.js
PhoneNumber.test.js.map
PhoneNumberMatcher.js
PhoneNumberMatcher.js.map
PhoneNumberMatcher.test.js
PhoneNumberMatcher.test.js.map
constants.js
constants.js.map
findNumbers
findPhoneNumbersInText.js
findPhoneNumbersInText.js.map
findPhoneNumbersInText.test.js
findPhoneNumbersInText.test.js.map
format.js
format.js.map
format.test.js
format.test.js.map
formatIncompletePhoneNumber.js
formatIncompletePhoneNumber.js.map
formatIncompletePhoneNumber.test.js
formatIncompletePhoneNumber.test.js.map
formatPhoneNumberForMobileDialing.js
formatPhoneNumberForMobileDialing.js.map
formatPhoneNumberForMobileDialing.test.js
formatPhoneNumberForMobileDialing.test.js.map
getCountries.js
getCountries.js.map
getCountries.test.js
getCountries.test.js.map
getCountryCallingCode.js
getCountryCallingCode.js.map
getCountryCallingCode.test.js
getCountryCallingCode.test.js.map
getExampleNumber.js
getExampleNumber.js.map
getExampleNumber.test.js
getExampleNumber.test.js.map
helpers
isPossible.js
isPossible.js.map
isPossible.test.js
isPossible.test.js.map
isPossiblePhoneNumber.js
isPossiblePhoneNumber.js.map
isPossiblePhoneNumber.test.js
isPossiblePhoneNumber.test.js.map
isValid.js
isValid.js.map
isValid.test.js
isValid.test.js.map
isValidPhoneNumber.js
isValidPhoneNumber.js.map
isValidPhoneNumber.test.js
isValidPhoneNumber.test.js.map
legacy
metadata.js
metadata.js.map
metadata.test.js
metadata.test.js.map
normalizeArguments.js
normalizeArguments.js.map
parse.js
parse.js.map
parse.test.js
parse.test.js.map
parseIncompletePhoneNumber.js
parseIncompletePhoneNumber.js.map
parseIncompletePhoneNumber.test.js
parseIncompletePhoneNumber.test.js.map
parsePhoneNumber.js
parsePhoneNumber.js.map
parsePhoneNumber.test.js
parsePhoneNumber.test.js.map
parsePhoneNumberWithError.js
parsePhoneNumberWithError.js.map
parsePhoneNumberWithError.test.js
parsePhoneNumberWithError.test.js.map
parsePhoneNumberWithError_.js
parsePhoneNumberWithError_.js.map
parsePhoneNumber_.js
parsePhoneNumber_.js.map
searchPhoneNumbersInText.js
searchPhoneNumbersInText.js.map
searchPhoneNumbersInText.test.js
searchPhoneNumbersInText.test.js.map
tools
validatePhoneNumberLength.js
validatePhoneNumberLength.js.map
validatePhoneNumberLength.test.js
validatePhoneNumberLength.test.js.map

مشاهدة ملف: format.js.map

{"version":3,"file":"format.js","names":["matchesEntirely","formatNationalNumberUsingFormat","Metadata","getCountryCallingCode","getIddPrefix","formatRFC3966","DEFAULT_OPTIONS","formatExtension","formattedNumber","extension","metadata","ext","formatNumber","input","format","options","country","hasCountry","Error","countryCallingCode","selectNumberingPlan","phone","nationalNumber","v2","number","formatNationalNumber","carrierCode","addExtension","fromCountry","formatIDD","formatAs","chooseFormatForNumber","formats","useInternationalFormat","withNationalPrefix","nationalPrefixIsOptionalWhenFormattingInNationalFormat","nationalPrefix","availableFormats","nationalNnumber","leadingDigitsPatterns","length","lastLeadingDigitsPattern","search","pattern","fromCountryCallingCode","iddPrefix","undefined"],"sources":["../source/format.js"],"sourcesContent":["// This is a port of Google Android `libphonenumber`'s\r\n// `phonenumberutil.js` of December 31th, 2018.\r\n//\r\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\r\n\r\nimport matchesEntirely from './helpers/matchesEntirely.js'\r\nimport formatNationalNumberUsingFormat from './helpers/formatNationalNumberUsingFormat.js'\r\nimport Metadata, { getCountryCallingCode } from './metadata.js'\r\nimport getIddPrefix from './helpers/getIddPrefix.js'\r\nimport { formatRFC3966 } from './helpers/RFC3966.js'\r\n\r\nconst DEFAULT_OPTIONS = {\r\n\tformatExtension: (formattedNumber, extension, metadata) => `${formattedNumber}${metadata.ext()}${extension}`\r\n}\r\n\r\n/**\r\n * Formats a phone number.\r\n *\r\n * format(phoneNumberInstance, 'INTERNATIONAL', { ..., v2: true }, metadata)\r\n * format(phoneNumberInstance, 'NATIONAL', { ..., v2: true }, metadata)\r\n *\r\n * format({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', { ... }, metadata)\r\n * format({ phone: '8005553535', country: 'RU' }, 'NATIONAL', 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  {string} format\r\n * @param  {object} [options]\r\n * @param  {object} metadata\r\n * @return {string}\r\n */\r\nexport default function formatNumber(input, format, options, metadata) {\r\n\t// Apply default options.\r\n\tif (options) {\r\n\t\toptions = { ...DEFAULT_OPTIONS, ...options }\r\n\t} else {\r\n\t\toptions = DEFAULT_OPTIONS\r\n\t}\r\n\r\n\tmetadata = new Metadata(metadata)\r\n\r\n\tif (input.country && input.country !== '001') {\r\n\t\t// Validate `input.country`.\r\n\t\tif (!metadata.hasCountry(input.country)) {\r\n\t\t\tthrow new Error(`Unknown country: ${input.country}`)\r\n\t\t}\r\n\t\tmetadata.country(input.country)\r\n\t}\r\n\telse if (input.countryCallingCode) {\r\n\t\tmetadata.selectNumberingPlan(input.countryCallingCode)\r\n\t}\r\n\telse return input.phone || ''\r\n\r\n\tconst countryCallingCode = metadata.countryCallingCode()\r\n\r\n\tconst nationalNumber = options.v2 ? input.nationalNumber : input.phone\r\n\r\n\t// This variable should have been declared inside `case`s\r\n\t// but Babel has a bug and it says \"duplicate variable declaration\".\r\n\tlet number\r\n\r\n\tswitch (format) {\r\n\t\tcase 'NATIONAL':\r\n\t\t\t// Legacy argument support.\r\n\t\t\t// (`{ country: ..., phone: '' }`)\r\n\t\t\tif (!nationalNumber) {\r\n\t\t\t\treturn ''\r\n\t\t\t}\r\n\t\t\tnumber = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options)\r\n\t\t\treturn addExtension(number, input.ext, metadata, options.formatExtension)\r\n\r\n\t\tcase 'INTERNATIONAL':\r\n\t\t\t// Legacy argument support.\r\n\t\t\t// (`{ country: ..., phone: '' }`)\r\n\t\t\tif (!nationalNumber) {\r\n\t\t\t\treturn `+${countryCallingCode}`\r\n\t\t\t}\r\n\t\t\tnumber = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options)\r\n\t\t\tnumber = `+${countryCallingCode} ${number}`\r\n\t\t\treturn addExtension(number, input.ext, metadata, options.formatExtension)\r\n\r\n\t\tcase 'E.164':\r\n\t\t\t// `E.164` doesn't define \"phone number extensions\".\r\n\t\t\treturn `+${countryCallingCode}${nationalNumber}`\r\n\r\n\t\tcase 'RFC3966':\r\n\t\t\treturn formatRFC3966({\r\n\t\t\t\tnumber: `+${countryCallingCode}${nationalNumber}`,\r\n\t\t\t\text: input.ext\r\n\t\t\t})\r\n\r\n\t\t// For reference, here's Google's IDD formatter:\r\n\t\t// https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546\r\n\t\t// Not saying that this IDD formatter replicates it 1:1, but it seems to work.\r\n\t\t// Who would even need to format phone numbers in IDD format anyway?\r\n\t\tcase 'IDD':\r\n\t\t\tif (!options.fromCountry) {\r\n\t\t\t\treturn\r\n\t\t\t\t// throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')\r\n\t\t\t}\r\n\t\t\tconst formattedNumber = formatIDD(\r\n\t\t\t\tnationalNumber,\r\n\t\t\t\tinput.carrierCode,\r\n\t\t\t\tcountryCallingCode,\r\n\t\t\t\toptions.fromCountry,\r\n\t\t\t\tmetadata\r\n\t\t\t)\r\n\t\t\treturn addExtension(formattedNumber, input.ext, metadata, options.formatExtension)\r\n\r\n\t\tdefault:\r\n\t\t\tthrow new Error(`Unknown \"format\" argument passed to \"formatNumber()\": \"${format}\"`)\r\n\t}\r\n}\r\n\r\nfunction formatNationalNumber(number, carrierCode, formatAs, metadata, options) {\r\n\tconst format = chooseFormatForNumber(metadata.formats(), number)\r\n\tif (!format) {\r\n\t\treturn number\r\n\t}\r\n\treturn formatNationalNumberUsingFormat(\r\n\t\tnumber,\r\n\t\tformat,\r\n\t\t{\r\n\t\t\tuseInternationalFormat: formatAs === 'INTERNATIONAL',\r\n\t\t\twithNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && (options && options.nationalPrefix === false) ? false : true,\r\n\t\t\tcarrierCode,\r\n\t\t\tmetadata\r\n\t\t}\r\n\t)\r\n}\r\n\r\nexport function chooseFormatForNumber(availableFormats, nationalNnumber) {\r\n\tfor (const format of availableFormats) {\r\n\t\t// Validate leading digits.\r\n\t\t// The test case for \"else path\" could be found by searching for\r\n\t\t// \"format.leadingDigitsPatterns().length === 0\".\r\n\t\tif (format.leadingDigitsPatterns().length > 0) {\r\n\t\t\t// The last leading_digits_pattern is used here, as it is the most detailed\r\n\t\t\tconst lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]\r\n\t\t\t// If leading digits don't match then move on to the next phone number format\r\n\t\t\tif (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Check that the national number matches the phone number format regular expression\r\n\t\tif (matchesEntirely(nationalNnumber, format.pattern())) {\r\n\t\t\treturn format\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction addExtension(formattedNumber, ext, metadata, formatExtension) {\r\n\treturn ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber\r\n}\r\n\r\nfunction formatIDD(\r\n\tnationalNumber,\r\n\tcarrierCode,\r\n\tcountryCallingCode,\r\n\tfromCountry,\r\n\tmetadata\r\n) {\r\n\tconst fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata)\r\n\t// When calling within the same country calling code.\r\n\tif (fromCountryCallingCode === countryCallingCode) {\r\n\t\tconst formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata)\r\n\t\t// For NANPA regions, return the national format for these regions\r\n\t\t// but prefix it with the country calling code.\r\n\t\tif (countryCallingCode === '1') {\r\n\t\t\treturn countryCallingCode + ' ' + formattedNumber\r\n\t\t}\r\n\t\t// If regions share a country calling code, the country calling code need\r\n\t\t// not be dialled. This also applies when dialling within a region, so this\r\n\t\t// if clause covers both these cases. Technically this is the case for\r\n\t\t// dialling from La Reunion to other overseas departments of France (French\r\n\t\t// Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover\r\n\t\t// this edge case for now and for those cases return the version including\r\n\t\t// country calling code. Details here:\r\n\t\t// http://www.petitfute.com/voyage/225-info-pratiques-reunion\r\n\t\t//\r\n\t\treturn formattedNumber\r\n\t}\r\n\tconst iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata)\r\n\tif (iddPrefix) {\r\n\t\treturn `${iddPrefix} ${countryCallingCode} ${formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metad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