pixel-react 1.15.11 → 1.15.12
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/README.md +75 -75
- package/lib/ThirdPartyPackages/JanusGateway.js +5 -2
- package/lib/ThirdPartyPackages/JanusGateway.js.map +1 -1
- package/lib/_virtual/index10.js +2 -2
- package/lib/_virtual/index11.js +2 -2
- package/lib/_virtual/index12.js +2 -2
- package/lib/_virtual/index9.js +2 -2
- package/lib/assets/icons/spinner.svg.js +1 -1
- package/lib/assets/icons/spinner.svg.js.map +1 -1
- package/lib/components/Editor/VariableDropdown.js +2 -2
- package/lib/index.cjs +7209 -4574
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +1 -1
- package/lib/node_modules/@date-fns/tz/date/index.js +19 -1
- package/lib/node_modules/@date-fns/tz/date/index.js.map +1 -1
- package/lib/node_modules/@date-fns/tz/date/mini.js +6 -34
- package/lib/node_modules/@date-fns/tz/date/mini.js.map +1 -1
- package/lib/node_modules/@date-fns/tz/tzOffset/index.js +5 -6
- package/lib/node_modules/@date-fns/tz/tzOffset/index.js.map +1 -1
- package/lib/node_modules/janus-gateway/npm/dist/janus.es.js +3241 -0
- package/lib/node_modules/janus-gateway/npm/dist/janus.es.js.map +1 -0
- package/lib/node_modules/js-beautify/js/src/css/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/css/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/tokenizer.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/index.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/javascript/tokenizer.js +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouType.js +82 -115
- package/lib/node_modules/libphonenumber-js/es6/AsYouType.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +58 -68
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +23 -36
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +9 -13
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js +187 -226
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js +27 -21
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeParser.js +117 -150
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeParser.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeState.js +38 -57
- package/lib/node_modules/libphonenumber-js/es6/AsYouTypeState.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/ParseError.js +109 -70
- package/lib/node_modules/libphonenumber-js/es6/ParseError.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/PhoneNumber.js +57 -72
- package/lib/node_modules/libphonenumber-js/es6/PhoneNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/constants.js +9 -15
- package/lib/node_modules/libphonenumber-js/es6/constants.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/format.js +93 -67
- package/lib/node_modules/libphonenumber-js/es6/format.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
- package/lib/node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/getCountries.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +1 -0
- package/lib/node_modules/libphonenumber-js/es6/helpers/RFC3966.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +10 -49
- package/lib/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +32 -20
- package/lib/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +4 -5
- package/lib/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +18 -25
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +11 -12
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +11 -13
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +11 -21
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +11 -12
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +12 -15
- package/lib/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +4 -4
- package/lib/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +35 -59
- package/lib/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +2 -2
- package/lib/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +36 -38
- package/lib/node_modules/libphonenumber-js/es6/helpers/getNumberType.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +1 -0
- package/lib/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/isObject.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +10 -14
- package/lib/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +4 -4
- package/lib/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +27 -22
- package/lib/node_modules/libphonenumber-js/es6/helpers/parseDigits.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +6 -6
- package/lib/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/isPossible.js +7 -6
- package/lib/node_modules/libphonenumber-js/es6/isPossible.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/isValid.js +5 -6
- package/lib/node_modules/libphonenumber-js/es6/isValid.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/isValidPhoneNumber.js +26 -44
- package/lib/node_modules/libphonenumber-js/es6/isValidPhoneNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/metadata.js +69 -120
- package/lib/node_modules/libphonenumber-js/es6/metadata.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/normalizeArguments.js +68 -87
- package/lib/node_modules/libphonenumber-js/es6/normalizeArguments.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/parse.js +40 -58
- package/lib/node_modules/libphonenumber-js/es6/parse.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +36 -32
- package/lib/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/parsePhoneNumber.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +26 -44
- package/lib/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +28 -46
- package/lib/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/es6/tools/semver-compare.js.map +1 -1
- package/lib/node_modules/libphonenumber-js/metadata.min.json.js +18 -18
- package/lib/node_modules/libphonenumber-js/metadata.min.json.js.map +1 -1
- package/lib/node_modules/prop-types/index.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/DayPicker.js +64 -88
- package/lib/node_modules/react-day-picker/dist/esm/DayPicker.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/UI.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/classes/DateLib.js +6 -71
- package/lib/node_modules/react-day-picker/dist/esm/classes/DateLib.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Button.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Chevron.js +14 -18
- package/lib/node_modules/react-day-picker/dist/esm/components/Chevron.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Day.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/DayButton.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Dropdown.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/DropdownNav.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Footer.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Month.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/MonthCaption.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/MonthGrid.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Months.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Nav.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Option.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Root.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Select.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Week.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/WeekNumber.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Weekday.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Weekdays.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/Weeks.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +2 -3
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatDay.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/formatters/index.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getComponents.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getDates.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getDays.js +4 -4
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getDays.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getMonths.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +2 -2
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +11 -9
- package/lib/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/index.js +2 -2
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +2 -3
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelGrid.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelNav.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelNext.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelNext.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/selection/useMulti.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/selection/useRange.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/selection/useSingle.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/useAnimation.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/useAnimation.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/useCalendar.js +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/useCalendar.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/useDayPicker.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/useFocus.js +0 -6
- package/lib/node_modules/react-day-picker/dist/esm/useFocus.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/useSelection.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/utils/addToRange.js +1 -6
- package/lib/node_modules/react-day-picker/dist/esm/utils/addToRange.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js.map +1 -1
- package/lib/node_modules/react-day-picker/dist/esm/utils/typeguards.js.map +1 -1
- package/lib/node_modules/react-hook-form/dist/index.esm.js +44 -67
- package/lib/node_modules/react-hook-form/dist/index.esm.js.map +1 -1
- package/lib/node_modules/react-virtuoso/dist/index.js +1200 -1246
- package/lib/node_modules/react-virtuoso/dist/index.js.map +1 -1
- package/lib/node_modules/ua-parser-js/src/ua-parser.js +71 -85
- package/lib/node_modules/ua-parser-js/src/ua-parser.js.map +1 -1
- package/lib/styles.css +1 -1
- package/lib/styles.css.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +106 -106
- package/lib/node_modules/@date-fns/tz/tzName/index.js +0 -40
- package/lib/node_modules/@date-fns/tz/tzName/index.js.map +0 -1
- package/lib/node_modules/react-day-picker/node_modules/date-fns/eachYearOfInterval.js +0 -64
- package/lib/node_modules/react-day-picker/node_modules/date-fns/eachYearOfInterval.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';
|
|
2
2
|
import matchesEntirely from './matchesEntirely.js';
|
|
3
3
|
import checkNumberLength from './checkNumberLength.js';
|
|
4
|
-
import getCountryByCallingCode from './getCountryByCallingCode.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Strips national prefix and carrier code from a complete phone number.
|
|
@@ -9,11 +8,11 @@ import getCountryByCallingCode from './getCountryByCallingCode.js';
|
|
|
9
8
|
* it won't extract national prefix if the resultant number is too short
|
|
10
9
|
* to be a complete number for the selected phone numbering plan.
|
|
11
10
|
* @param {string} number — Complete phone number digits.
|
|
12
|
-
* @param {string?} country — Country, if known.
|
|
13
11
|
* @param {Metadata} metadata — Metadata with a phone numbering plan selected.
|
|
14
12
|
* @return {object} `{ nationalNumber: string, carrierCode: string? }`.
|
|
15
13
|
*/
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
function extractNationalNumber(number, metadata) {
|
|
17
16
|
// Parsing national prefixes and carrier codes
|
|
18
17
|
// is only required for local phone numbers
|
|
19
18
|
// but some people don't understand that
|
|
@@ -32,18 +31,10 @@ function extractNationalNumber(number, country, metadata) {
|
|
|
32
31
|
return {
|
|
33
32
|
nationalNumber: number
|
|
34
33
|
};
|
|
35
|
-
}
|
|
36
|
-
// Check the national (significant) number length after extracting national prefix and carrier code.
|
|
34
|
+
} // Check the national (significant) number length after extracting national prefix and carrier code.
|
|
37
35
|
// Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature.
|
|
38
|
-
if (metadata.numberingPlan.possibleLengths()) {
|
|
39
|
-
// If an exact `country` is not specified, attempt to detect it from the assumed national number.
|
|
40
|
-
if (!country) {
|
|
41
|
-
country = getCountryByCallingCode(metadata.numberingPlan.callingCode(), {
|
|
42
|
-
nationalNumber: nationalNumber,
|
|
43
|
-
metadata: metadata
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
36
|
|
|
37
|
+
if (metadata.possibleLengths()) {
|
|
47
38
|
// The number remaining after stripping the national prefix and carrier code
|
|
48
39
|
// should be long enough to have a possible length for the country.
|
|
49
40
|
// Otherwise, don't strip the national prefix and carrier code,
|
|
@@ -52,7 +43,7 @@ function extractNationalNumber(number, country, metadata) {
|
|
|
52
43
|
// https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250
|
|
53
44
|
// It doesn't check for the "possibility" of the original `number`.
|
|
54
45
|
// I guess it's fine not checking that one. It works as is anyway.
|
|
55
|
-
if (!isPossibleIncompleteNationalNumber(nationalNumber,
|
|
46
|
+
if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) {
|
|
56
47
|
// Don't strip the national prefix.
|
|
57
48
|
return {
|
|
58
49
|
nationalNumber: number
|
|
@@ -64,9 +55,7 @@ function extractNationalNumber(number, country, metadata) {
|
|
|
64
55
|
nationalNumber: nationalNumber,
|
|
65
56
|
carrierCode: carrierCode
|
|
66
57
|
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// In some countries, the same digit could be a national prefix
|
|
58
|
+
} // In some countries, the same digit could be a national prefix
|
|
70
59
|
// or a leading digit of a valid phone number.
|
|
71
60
|
// For example, in Russia, national prefix is `8`,
|
|
72
61
|
// and also `800 555 35 35` is a valid number
|
|
@@ -80,13 +69,13 @@ function extractNationalNumber(number, country, metadata) {
|
|
|
80
69
|
// is not extracted when the original number is "viable" and the
|
|
81
70
|
// resultant number is not, a "viable" national number being the one
|
|
82
71
|
// that matches `national_number_pattern`.
|
|
72
|
+
|
|
83
73
|
function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {
|
|
84
74
|
// The equivalent in Google's code is:
|
|
85
75
|
// https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004
|
|
86
76
|
if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {
|
|
87
77
|
return false;
|
|
88
|
-
}
|
|
89
|
-
// This "is possible" national number (length) check has been commented out
|
|
78
|
+
} // This "is possible" national number (length) check has been commented out
|
|
90
79
|
// because it's superceded by the (effectively) same check done in the
|
|
91
80
|
// `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.
|
|
92
81
|
// In other words, why run the same check twice if it could only be run once.
|
|
@@ -99,10 +88,11 @@ function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberA
|
|
|
99
88
|
// return false
|
|
100
89
|
// }
|
|
101
90
|
// }
|
|
91
|
+
|
|
102
92
|
return true;
|
|
103
93
|
}
|
|
104
|
-
function isPossibleIncompleteNationalNumber(nationalNumber,
|
|
105
|
-
switch (checkNumberLength(nationalNumber,
|
|
94
|
+
function isPossibleIncompleteNationalNumber(nationalNumber, metadata) {
|
|
95
|
+
switch (checkNumberLength(nationalNumber, metadata)) {
|
|
106
96
|
case 'TOO_SHORT':
|
|
107
97
|
case 'INVALID_LENGTH':
|
|
108
98
|
// This library ignores "local-only" phone numbers (for simplicity).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractNationalNumber.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js"],"sourcesContent":["import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport checkNumberLength from './checkNumberLength.js';\
|
|
1
|
+
{"version":3,"file":"extractNationalNumber.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js"],"sourcesContent":["import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport checkNumberLength from './checkNumberLength.js';\n/**\r\n * Strips national prefix and carrier code from a complete phone number.\r\n * The difference from the non-\"FromCompleteNumber\" function is that\r\n * it won't extract national prefix if the resultant number is too short\r\n * to be a complete number for the selected phone numbering plan.\r\n * @param {string} number — Complete phone number digits.\r\n * @param {Metadata} metadata — Metadata with a phone numbering plan selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\n\nexport default function extractNationalNumber(number, metadata) {\n // Parsing national prefixes and carrier codes\n // is only required for local phone numbers\n // but some people don't understand that\n // and sometimes write international phone numbers\n // with national prefixes (or maybe even carrier codes).\n // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n // Google's original library forgives such mistakes\n // and so does this library, because it has been requested:\n // https://github.com/catamphetamine/libphonenumber-js/issues/127\n var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),\n carrierCode = _extractNationalNumbe.carrierCode,\n nationalNumber = _extractNationalNumbe.nationalNumber;\n\n if (nationalNumber !== number) {\n if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n } // Check the national (significant) number length after extracting national prefix and carrier code.\n // Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature.\n\n\n if (metadata.possibleLengths()) {\n // The number remaining after stripping the national prefix and carrier code\n // should be long enough to have a possible length for the country.\n // Otherwise, don't strip the national prefix and carrier code,\n // since the original number could be a valid number.\n // This check has been copy-pasted \"as is\" from Google's original library:\n // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250\n // It doesn't check for the \"possibility\" of the original `number`.\n // I guess it's fine not checking that one. It works as is anyway.\n if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n }\n }\n\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n} // In some countries, the same digit could be a national prefix\n// or a leading digit of a valid phone number.\n// For example, in Russia, national prefix is `8`,\n// and also `800 555 35 35` is a valid number\n// in which `8` is not a national prefix, but the first digit\n// of a national (significant) number.\n// Same's with Belarus:\n// `82004910060` is a valid national (significant) number,\n// but `2004910060` is not.\n// To support such cases (to prevent the code from always stripping\n// national prefix), a condition is imposed: a national prefix\n// is not extracted when the original number is \"viable\" and the\n// resultant number is not, a \"viable\" national number being the one\n// that matches `national_number_pattern`.\n\nfunction shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {\n // The equivalent in Google's code is:\n // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004\n if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {\n return false;\n } // This \"is possible\" national number (length) check has been commented out\n // because it's superceded by the (effectively) same check done in the\n // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.\n // In other words, why run the same check twice if it could only be run once.\n // // Check the national (significant) number length after extracting national prefix and carrier code.\n // // Fixes a minor \"weird behavior\" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57\n // // (Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature).\n // if (metadata.possibleLengths()) {\n // \tif (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) &&\n // \t\t!isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) {\n // \t\treturn false\n // \t}\n // }\n\n\n return true;\n}\n\nfunction isPossibleIncompleteNationalNumber(nationalNumber, metadata) {\n switch (checkNumberLength(nationalNumber, metadata)) {\n case 'TOO_SHORT':\n case 'INVALID_LENGTH':\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n return false;\n\n default:\n return true;\n }\n}\n//# sourceMappingURL=extractNationalNumber.js.map"],"names":["extractNationalNumber","number","metadata","_extractNationalNumbe","extractNationalNumberFromPossiblyIncompleteNumber","carrierCode","nationalNumber","shouldHaveExtractedNationalPrefix","possibleLengths","isPossibleIncompleteNationalNumber","nationalNumberBefore","nationalNumberAfter","matchesEntirely","nationalNumberPattern","checkNumberLength"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASA,qBAATA,CAA+BC,MAA/B,EAAuCC,QAAvC,EAAiD;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,IAAAC,qBAAA,GAGIC,iDAAiD,CACpDH,MADoD,EAEpDC,QAFoD,CAHrD;IACCG,WADD,GAAAF,qBAAA,CACCE,WADD;IAECC,cAFD,GAAAH,qBAAA,CAECG,cAFD;EAQA,IAAIA,cAAc,KAAKL,MAAvB,EAA+B;IAC9B,IAAI,CAACM,iCAAiC,CAACN,MAAD,EAASK,cAAT,EAAyBJ,QAAzB,CAAtC,EAA0E;AACzE;MACA,OAAO;AAAEI,QAAAA,cAAc,EAAEL;OAAzB;AACA,IAAA,CAJ6B;AAM9B;;AACA,IAAA,IAAIC,QAAQ,CAACM,eAAT,EAAJ,EAAgC;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAA,IAAI,CAACC,kCAAkC,CAACH,cAAD,EAAiBJ,QAAjB,CAAvC,EAAmE;AAClE;QACA,OAAO;AAAEI,UAAAA,cAAc,EAAEL;SAAzB;AACA,MAAA;AACD,IAAA;AACD,EAAA;EAED,OAAO;AAAEK,IAAAA,cAAc,EAAdA,cAAF;AAAkBD,IAAAA,WAAW,EAAXA;GAAzB;AACA;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASE,iCAATA,CAA2CG,oBAA3C,EAAiEC,mBAAjE,EAAsFT,QAAtF,EAAgG;AAC/F;AACA;EACA,IAAIU,eAAe,CAACF,oBAAD,EAAuBR,QAAQ,CAACW,qBAAT,EAAvB,CAAf,IACH,CAACD,eAAe,CAACD,mBAAD,EAAsBT,QAAQ,CAACW,qBAAT,EAAtB,CADjB,EAC0E;AACzE,IAAA,OAAO,KAAP;AACA,EAAA,CAN8F;AAQ/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,EAAA,OAAO,IAAP;AACA;AAED,SAASJ,kCAATA,CAA4CH,cAA5C,EAA4DJ,QAA5D,EAAsE;AACrE,EAAA,QAAQY,iBAAiB,CAACR,cAAD,EAAiBJ,QAAjB,CAAzB;AACC,IAAA,KAAK,WAAL;AACA,IAAA,KAAK,gBAAL;AACA;AACA;AACA;AACC,MAAA,OAAO,KAAP;AACD,IAAA;AACC,MAAA,OAAO,IAAP;AARF;AAUA;;;;","x_google_ignoreList":[0]}
|
|
@@ -20,8 +20,7 @@ function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
|
|
|
20
20
|
var prefixMatch = prefixPattern.exec(number);
|
|
21
21
|
if (prefixMatch) {
|
|
22
22
|
var nationalNumber;
|
|
23
|
-
var carrierCode;
|
|
24
|
-
// https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
23
|
+
var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
25
24
|
// If a `national_prefix_for_parsing` has any "capturing groups"
|
|
26
25
|
// then it means that the national (significant) number is equal to
|
|
27
26
|
// those "capturing groups" transformed via `national_prefix_transform_rule`,
|
|
@@ -37,17 +36,17 @@ function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
|
|
|
37
36
|
// It's not possible to tell whether there'll be any "capturing gropus"
|
|
38
37
|
// before the matching process, because a `national_prefix_for_parsing`
|
|
39
38
|
// could exhibit both behaviors.
|
|
39
|
+
|
|
40
40
|
var capturedGroupsCount = prefixMatch.length - 1;
|
|
41
41
|
var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];
|
|
42
42
|
if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {
|
|
43
|
-
nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule());
|
|
44
|
-
// If there's more than one captured group,
|
|
43
|
+
nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group,
|
|
45
44
|
// then carrier code is the second one.
|
|
45
|
+
|
|
46
46
|
if (capturedGroupsCount > 1) {
|
|
47
47
|
carrierCode = prefixMatch[1];
|
|
48
48
|
}
|
|
49
|
-
}
|
|
50
|
-
// If there're no "capturing groups",
|
|
49
|
+
} // If there're no "capturing groups",
|
|
51
50
|
// or if there're "capturing groups" but no
|
|
52
51
|
// `national_prefix_transform_rule`,
|
|
53
52
|
// then just strip the national prefix from the number,
|
|
@@ -60,28 +59,28 @@ function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
|
|
|
60
59
|
// For example, if there's a carrier code, it's gonna be a
|
|
61
60
|
// part of `prefixBeforeNationalNumber` too.
|
|
62
61
|
var prefixBeforeNationalNumber = prefixMatch[0];
|
|
63
|
-
nationalNumber = number.slice(prefixBeforeNationalNumber.length);
|
|
64
|
-
// If there's at least one captured group,
|
|
62
|
+
nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group,
|
|
65
63
|
// then carrier code is the first one.
|
|
64
|
+
|
|
66
65
|
if (hasCapturedGroups) {
|
|
67
66
|
carrierCode = prefixMatch[1];
|
|
68
67
|
}
|
|
69
|
-
}
|
|
70
|
-
// Tries to guess whether a national prefix was present in the input.
|
|
68
|
+
} // Tries to guess whether a national prefix was present in the input.
|
|
71
69
|
// This is not something copy-pasted from Google's library:
|
|
72
70
|
// they don't seem to have an equivalent for that.
|
|
73
71
|
// So this isn't an "officially approved" way of doing something like that.
|
|
74
72
|
// But since there seems no other existing method, this library uses it.
|
|
73
|
+
|
|
75
74
|
var nationalPrefix;
|
|
76
75
|
if (hasCapturedGroups) {
|
|
77
76
|
var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);
|
|
78
|
-
var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup);
|
|
79
|
-
// Example: an Argentinian (AR) phone number `0111523456789`.
|
|
77
|
+
var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`.
|
|
80
78
|
// `prefixMatch[0]` is `01115`, and `$1` is `11`,
|
|
81
79
|
// and the rest of the phone number is `23456789`.
|
|
82
80
|
// The national number is transformed via `9$1` to `91123456789`.
|
|
83
81
|
// National prefix `0` is detected being present at the start.
|
|
84
82
|
// if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {
|
|
83
|
+
|
|
85
84
|
if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {
|
|
86
85
|
nationalPrefix = metadata.numberingPlan.nationalPrefix();
|
|
87
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractNationalNumberFromPossiblyIncompleteNumber.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js"],"sourcesContent":["/**\r\n * Strips any national prefix (such as 0, 1) present in a\r\n * (possibly incomplete) number provided.\r\n * \"Carrier codes\" are only used in Colombia and Brazil,\r\n * and only when dialing within those countries from a mobile phone to a fixed line number.\r\n * Sometimes it won't actually strip national prefix\r\n * and will instead prepend some digits to the `number`:\r\n * for example, when number `2345678` is passed with `VI` country selected,\r\n * it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\r\n * @param {string} number — National number digits.\r\n * @param {object} metadata — Metadata with country selected.\r\n * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not.\r\n */\nexport default function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {\n if (number && metadata.numberingPlan.nationalPrefixForParsing()) {\n // See METADATA.md for the description of\n // `national_prefix_for_parsing` and `national_prefix_transform_rule`.\n // Attempt to parse the first digits as a national prefix.\n var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');\n var prefixMatch = prefixPattern.exec(number);\n if (prefixMatch) {\n var nationalNumber;\n var carrierCode
|
|
1
|
+
{"version":3,"file":"extractNationalNumberFromPossiblyIncompleteNumber.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js"],"sourcesContent":["/**\r\n * Strips any national prefix (such as 0, 1) present in a\r\n * (possibly incomplete) number provided.\r\n * \"Carrier codes\" are only used in Colombia and Brazil,\r\n * and only when dialing within those countries from a mobile phone to a fixed line number.\r\n * Sometimes it won't actually strip national prefix\r\n * and will instead prepend some digits to the `number`:\r\n * for example, when number `2345678` is passed with `VI` country selected,\r\n * it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\r\n * @param {string} number — National number digits.\r\n * @param {object} metadata — Metadata with country selected.\r\n * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not.\r\n */\nexport default function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {\n if (number && metadata.numberingPlan.nationalPrefixForParsing()) {\n // See METADATA.md for the description of\n // `national_prefix_for_parsing` and `national_prefix_transform_rule`.\n // Attempt to parse the first digits as a national prefix.\n var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');\n var prefixMatch = prefixPattern.exec(number);\n\n if (prefixMatch) {\n var nationalNumber;\n var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule\n // If a `national_prefix_for_parsing` has any \"capturing groups\"\n // then it means that the national (significant) number is equal to\n // those \"capturing groups\" transformed via `national_prefix_transform_rule`,\n // and nothing could be said about the actual national prefix:\n // what is it and was it even there.\n // If a `national_prefix_for_parsing` doesn't have any \"capturing groups\",\n // then everything it matches is a national prefix.\n // To determine whether `national_prefix_for_parsing` matched any\n // \"capturing groups\", the value of the result of calling `.exec()`\n // is looked at, and if it has non-undefined values where there're\n // \"capturing groups\" in the regular expression, then it means\n // that \"capturing groups\" have been matched.\n // It's not possible to tell whether there'll be any \"capturing gropus\"\n // before the matching process, because a `national_prefix_for_parsing`\n // could exhibit both behaviors.\n\n var capturedGroupsCount = prefixMatch.length - 1;\n var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];\n\n if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {\n nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group,\n // then carrier code is the second one.\n\n if (capturedGroupsCount > 1) {\n carrierCode = prefixMatch[1];\n }\n } // If there're no \"capturing groups\",\n // or if there're \"capturing groups\" but no\n // `national_prefix_transform_rule`,\n // then just strip the national prefix from the number,\n // and possibly a carrier code.\n // Seems like there could be more.\n else {\n // `prefixBeforeNationalNumber` is the whole substring matched by\n // the `national_prefix_for_parsing` regular expression.\n // There seem to be no guarantees that it's just a national prefix.\n // For example, if there's a carrier code, it's gonna be a\n // part of `prefixBeforeNationalNumber` too.\n var prefixBeforeNationalNumber = prefixMatch[0];\n nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group,\n // then carrier code is the first one.\n\n if (hasCapturedGroups) {\n carrierCode = prefixMatch[1];\n }\n } // Tries to guess whether a national prefix was present in the input.\n // This is not something copy-pasted from Google's library:\n // they don't seem to have an equivalent for that.\n // So this isn't an \"officially approved\" way of doing something like that.\n // But since there seems no other existing method, this library uses it.\n\n\n var nationalPrefix;\n\n if (hasCapturedGroups) {\n var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);\n var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`.\n // `prefixMatch[0]` is `01115`, and `$1` is `11`,\n // and the rest of the phone number is `23456789`.\n // The national number is transformed via `9$1` to `91123456789`.\n // National prefix `0` is detected being present at the start.\n // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {\n\n if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {\n nationalPrefix = metadata.numberingPlan.nationalPrefix();\n }\n } else {\n nationalPrefix = prefixMatch[0];\n }\n\n return {\n nationalNumber: nationalNumber,\n nationalPrefix: nationalPrefix,\n carrierCode: carrierCode\n };\n }\n }\n\n return {\n nationalNumber: number\n };\n}\n//# sourceMappingURL=extractNationalNumberFromPossiblyIncompleteNumber.js.map"],"names":["extractNationalNumberFromPossiblyIncompleteNumber","number","metadata","numberingPlan","nationalPrefixForParsing","prefixPattern","RegExp","prefixMatch","exec","nationalNumber","carrierCode","capturedGroupsCount","length","hasCapturedGroups","nationalPrefixTransformRule","replace","prefixBeforeNationalNumber","slice","nationalPrefix","possiblePositionOfTheFirstCapturedGroup","indexOf","possibleNationalPrefix"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,iDAATA,CAA2DC,MAA3D,EAAmEC,QAAnE,EAA6E;EAC3F,IAAID,MAAM,IAAIC,QAAQ,CAACC,aAAT,CAAuBC,wBAAvB,EAAd,EAAiE;AAChE;AACA;AACA;AACA,IAAA,IAAMC,aAAa,GAAG,IAAIC,MAAJ,CAAW,MAAA,GAASJ,QAAQ,CAACC,aAAT,CAAuBC,wBAAvB,EAAT,GAA6D,GAAxE,CAAtB;AACA,IAAA,IAAMG,WAAW,GAAGF,aAAa,CAACG,IAAd,CAAmBP,MAAnB,CAApB;AACA,IAAA,IAAIM,WAAJ,EAAiB;AAChB,MAAA,IAAIE,cAAJ;MACA,IAAIC,WAAJ,CAFgB;AAIhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAA,IAAMC,mBAAmB,GAAGJ,WAAW,CAACK,MAAZ,GAAqB,CAAjD;MACA,IAAMC,iBAAiB,GAAGF,mBAAmB,GAAG,CAAtB,IAA2BJ,WAAW,CAACI,mBAAD,CAAhE;AACA,MAAA,IAAIT,QAAQ,CAACY,2BAAT,EAAA,IAA0CD,iBAA9C,EAAiE;AAChEJ,QAAAA,cAAc,GAAGR,MAAM,CAACc,OAAP,CAChBV,aADgB,EAEhBH,QAAQ,CAACY,2BAAT,EAFgB,CAAjB,CADgE;AAMhE;;QACA,IAAIH,mBAAmB,GAAG,CAA1B,EAA6B;AAC5BD,UAAAA,WAAW,GAAGH,WAAW,CAAC,CAAD,CAAzB;AACA,QAAA;AACD,MAAA,CAVD;AAYA;AACA;AACA;AACA;AACA;WACK;AACJ;AACA;AACA;AACA;AACA;AACA,QAAA,IAAMS,0BAA0B,GAAGT,WAAW,CAAC,CAAD,CAA9C;QACAE,cAAc,GAAGR,MAAM,CAACgB,KAAP,CAAaD,0BAA0B,CAACJ,MAAxC,CAAjB,CAPI;AASJ;;AACA,QAAA,IAAIC,iBAAJ,EAAuB;AACtBH,UAAAA,WAAW,GAAGH,WAAW,CAAC,CAAD,CAAzB;AACA,QAAA;AACD,MAAA,CAnDe;AAqDhB;AACA;AACA;AACA;;AACA,MAAA,IAAIW,cAAJ;AACA,MAAA,IAAIL,iBAAJ,EAAuB;QACtB,IAAMM,uCAAuC,GAAGlB,MAAM,CAACmB,OAAP,CAAeb,WAAW,CAAC,CAAD,CAA1B,CAAhD;QACA,IAAMc,sBAAsB,GAAGpB,MAAM,CAACgB,KAAP,CAAa,CAAb,EAAgBE,uCAAhB,CAA/B,CAFsB;AAItB;AACA;AACA;AACA;AACA;;QACA,IAAIE,sBAAsB,KAAKnB,QAAQ,CAACC,aAAT,CAAuBe,cAAvB,EAA/B,EAAwE;AACvEA,UAAAA,cAAc,GAAGhB,QAAQ,CAACC,aAAT,CAAuBe,cAAvB,EAAjB;AACA,QAAA;AACD,MAAA,CAZD,MAYO;AACNA,QAAAA,cAAc,GAAGX,WAAW,CAAC,CAAD,CAA5B;AACA,MAAA;MACD,OAAO;AACNE,QAAAA,cAAc,EAAdA,cADM;AAENS,QAAAA,cAAc,EAAdA,cAFM;AAGNR,QAAAA,WAAW,EAAXA;OAHD;AAKA,IAAA;AACD,EAAA;EACC,OAAO;AACND,IAAAA,cAAc,EAAER;GADjB;AAGF;;;;","x_google_ignoreList":[0]}
|
|
@@ -5,35 +5,32 @@ import { VALID_DIGITS } from '../constants.js';
|
|
|
5
5
|
// Example: `"tel:12133734253;phone-context=+1"`.
|
|
6
6
|
// This function parses the full phone number from the local number and the `phone-context`
|
|
7
7
|
// when the `phone-context` contains a `+` sign.
|
|
8
|
-
|
|
9
8
|
var PLUS_SIGN = '+';
|
|
10
9
|
var RFC3966_VISUAL_SEPARATOR_ = '[\\-\\.\\(\\)]?';
|
|
11
10
|
var RFC3966_PHONE_DIGIT_ = '(' + '[' + VALID_DIGITS + ']' + '|' + RFC3966_VISUAL_SEPARATOR_ + ')';
|
|
12
11
|
var RFC3966_GLOBAL_NUMBER_DIGITS_ = '^' + '\\' + PLUS_SIGN + RFC3966_PHONE_DIGIT_ + '*' + '[' + VALID_DIGITS + ']' + RFC3966_PHONE_DIGIT_ + '*' + '$';
|
|
13
|
-
|
|
14
12
|
/**
|
|
15
13
|
* Regular expression of valid global-number-digits for the phone-context
|
|
16
14
|
* parameter, following the syntax defined in RFC3966.
|
|
17
15
|
*/
|
|
18
|
-
var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, 'g');
|
|
19
16
|
|
|
20
|
-
// In this port of Google's library, we don't accept alpha characters in phone numbers.
|
|
17
|
+
var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, 'g'); // In this port of Google's library, we don't accept alpha characters in phone numbers.
|
|
21
18
|
// const ALPHANUM_ = VALID_ALPHA_ + VALID_DIGITS
|
|
19
|
+
|
|
22
20
|
var ALPHANUM_ = VALID_DIGITS;
|
|
23
21
|
var RFC3966_DOMAINLABEL_ = '[' + ALPHANUM_ + ']+((\\-)*[' + ALPHANUM_ + '])*';
|
|
24
22
|
var VALID_ALPHA_ = 'a-zA-Z';
|
|
25
23
|
var RFC3966_TOPLABEL_ = '[' + VALID_ALPHA_ + ']+((\\-)*[' + ALPHANUM_ + '])*';
|
|
26
24
|
var RFC3966_DOMAINNAME_ = '^(' + RFC3966_DOMAINLABEL_ + '\\.)*' + RFC3966_TOPLABEL_ + '\\.?$';
|
|
27
|
-
|
|
28
25
|
/**
|
|
29
26
|
* Regular expression of valid domainname for the phone-context parameter,
|
|
30
27
|
* following the syntax defined in RFC3966.
|
|
31
28
|
*/
|
|
29
|
+
|
|
32
30
|
var RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, 'g');
|
|
33
31
|
var RFC3966_PREFIX_ = 'tel:';
|
|
34
32
|
var RFC3966_PHONE_CONTEXT_ = ';phone-context=';
|
|
35
33
|
var RFC3966_ISDN_SUBADDRESS_ = ';isub=';
|
|
36
|
-
|
|
37
34
|
/**
|
|
38
35
|
* Extracts the value of the phone-context parameter of `numberToExtractFrom`,
|
|
39
36
|
* following the syntax defined in RFC3966.
|
|
@@ -41,41 +38,41 @@ var RFC3966_ISDN_SUBADDRESS_ = ';isub=';
|
|
|
41
38
|
* @param {string} numberToExtractFrom
|
|
42
39
|
* @return {string|null} the extracted string (possibly empty), or `null` if no phone-context parameter is found.
|
|
43
40
|
*/
|
|
41
|
+
|
|
44
42
|
function extractPhoneContext(numberToExtractFrom) {
|
|
45
|
-
var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_);
|
|
46
|
-
|
|
43
|
+
var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_); // If no phone-context parameter is present
|
|
44
|
+
|
|
47
45
|
if (indexOfPhoneContext < 0) {
|
|
48
46
|
return null;
|
|
49
47
|
}
|
|
50
|
-
var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length;
|
|
51
|
-
|
|
48
|
+
var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length; // If phone-context parameter is empty
|
|
49
|
+
|
|
52
50
|
if (phoneContextStart >= numberToExtractFrom.length) {
|
|
53
51
|
return '';
|
|
54
52
|
}
|
|
55
|
-
var phoneContextEnd = numberToExtractFrom.indexOf(';', phoneContextStart);
|
|
56
|
-
|
|
53
|
+
var phoneContextEnd = numberToExtractFrom.indexOf(';', phoneContextStart); // If phone-context is not the last parameter
|
|
54
|
+
|
|
57
55
|
if (phoneContextEnd >= 0) {
|
|
58
56
|
return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd);
|
|
59
57
|
} else {
|
|
60
58
|
return numberToExtractFrom.substring(phoneContextStart);
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
|
-
|
|
64
61
|
/**
|
|
65
62
|
* Returns whether the value of phoneContext follows the syntax defined in RFC3966.
|
|
66
63
|
*
|
|
67
64
|
* @param {string|null} phoneContext
|
|
68
65
|
* @return {boolean}
|
|
69
66
|
*/
|
|
67
|
+
|
|
70
68
|
function isPhoneContextValid(phoneContext) {
|
|
71
69
|
if (phoneContext === null) {
|
|
72
70
|
return true;
|
|
73
71
|
}
|
|
74
72
|
if (phoneContext.length === 0) {
|
|
75
73
|
return false;
|
|
76
|
-
}
|
|
74
|
+
} // Does phone-context value match pattern of global-number-digits or domainname.
|
|
77
75
|
|
|
78
|
-
// Does phone-context value match pattern of global-number-digits or domainname.
|
|
79
76
|
return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);
|
|
80
77
|
}
|
|
81
78
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractPhoneContext.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js"],"sourcesContent":["// When phone numbers are written in `RFC3966` format — `\"tel:+12133734253\"` —\n// they can have their \"calling code\" part written separately in a `phone-context` parameter.\n// Example: `\"tel:12133734253;phone-context=+1\"`.\n// This function parses the full phone number from the local number and the `phone-context`\n// when the `phone-context` contains a `+` sign.\
|
|
1
|
+
{"version":3,"file":"extractPhoneContext.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js"],"sourcesContent":["// When phone numbers are written in `RFC3966` format — `\"tel:+12133734253\"` —\n// they can have their \"calling code\" part written separately in a `phone-context` parameter.\n// Example: `\"tel:12133734253;phone-context=+1\"`.\n// This function parses the full phone number from the local number and the `phone-context`\n// when the `phone-context` contains a `+` sign.\nimport { VALID_DIGITS // PLUS_CHARS\n} from '../constants.js';\nexport var PLUS_SIGN = '+';\nvar RFC3966_VISUAL_SEPARATOR_ = '[\\\\-\\\\.\\\\(\\\\)]?';\nvar RFC3966_PHONE_DIGIT_ = '(' + '[' + VALID_DIGITS + ']' + '|' + RFC3966_VISUAL_SEPARATOR_ + ')';\nvar RFC3966_GLOBAL_NUMBER_DIGITS_ = '^' + '\\\\' + PLUS_SIGN + RFC3966_PHONE_DIGIT_ + '*' + '[' + VALID_DIGITS + ']' + RFC3966_PHONE_DIGIT_ + '*' + '$';\n/**\r\n * Regular expression of valid global-number-digits for the phone-context\r\n * parameter, following the syntax defined in RFC3966.\r\n */\n\nvar RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, 'g'); // In this port of Google's library, we don't accept alpha characters in phone numbers.\n// const ALPHANUM_ = VALID_ALPHA_ + VALID_DIGITS\n\nvar ALPHANUM_ = VALID_DIGITS;\nvar RFC3966_DOMAINLABEL_ = '[' + ALPHANUM_ + ']+((\\\\-)*[' + ALPHANUM_ + '])*';\nvar VALID_ALPHA_ = 'a-zA-Z';\nvar RFC3966_TOPLABEL_ = '[' + VALID_ALPHA_ + ']+((\\\\-)*[' + ALPHANUM_ + '])*';\nvar RFC3966_DOMAINNAME_ = '^(' + RFC3966_DOMAINLABEL_ + '\\\\.)*' + RFC3966_TOPLABEL_ + '\\\\.?$';\n/**\r\n * Regular expression of valid domainname for the phone-context parameter,\r\n * following the syntax defined in RFC3966.\r\n */\n\nvar RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, 'g');\nexport var RFC3966_PREFIX_ = 'tel:';\nexport var RFC3966_PHONE_CONTEXT_ = ';phone-context=';\nexport var RFC3966_ISDN_SUBADDRESS_ = ';isub=';\n/**\r\n * Extracts the value of the phone-context parameter of `numberToExtractFrom`,\r\n * following the syntax defined in RFC3966.\r\n *\r\n * @param {string} numberToExtractFrom\r\n * @return {string|null} the extracted string (possibly empty), or `null` if no phone-context parameter is found.\r\n */\n\nexport default function extractPhoneContext(numberToExtractFrom) {\n var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_); // If no phone-context parameter is present\n\n if (indexOfPhoneContext < 0) {\n return null;\n }\n\n var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length; // If phone-context parameter is empty\n\n if (phoneContextStart >= numberToExtractFrom.length) {\n return '';\n }\n\n var phoneContextEnd = numberToExtractFrom.indexOf(';', phoneContextStart); // If phone-context is not the last parameter\n\n if (phoneContextEnd >= 0) {\n return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd);\n } else {\n return numberToExtractFrom.substring(phoneContextStart);\n }\n}\n/**\r\n * Returns whether the value of phoneContext follows the syntax defined in RFC3966.\r\n *\r\n * @param {string|null} phoneContext\r\n * @return {boolean}\r\n */\n\nexport function isPhoneContextValid(phoneContext) {\n if (phoneContext === null) {\n return true;\n }\n\n if (phoneContext.length === 0) {\n return false;\n } // Does phone-context value match pattern of global-number-digits or domainname.\n\n\n return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);\n}\n//# sourceMappingURL=extractPhoneContext.js.map"],"names":["PLUS_SIGN","RFC3966_VISUAL_SEPARATOR_","RFC3966_PHONE_DIGIT_","VALID_DIGITS","RFC3966_GLOBAL_NUMBER_DIGITS_","RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_","RegExp","ALPHANUM_","RFC3966_DOMAINLABEL_","VALID_ALPHA_","RFC3966_TOPLABEL_","RFC3966_DOMAINNAME_","RFC3966_DOMAINNAME_PATTERN_","RFC3966_PREFIX_","RFC3966_PHONE_CONTEXT_","RFC3966_ISDN_SUBADDRESS_","extractPhoneContext","numberToExtractFrom","indexOfPhoneContext","indexOf","phoneContextStart","length","phoneContextEnd","substring","isPhoneContextValid","phoneContext","test"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAOO,IAAMA,SAAS,GAAG;AAEzB,IAAMC,yBAAyB,GAAG,iBAAlC;AAEA,IAAMC,oBAAoB,GAAG,GAAA,GAAM,GAAN,GAAYC,YAAZ,GAA2B,GAA3B,GAAiC,GAAjC,GAAuCF,yBAAvC,GAAmE,GAAhG;AAEA,IAAMG,6BAA6B,GAClC,GAAA,GACA,IADA,GAEAJ,SAFA,GAGAE,oBAHA,GAIA,GAJA,GAKA,GALA,GAKMC,YALN,GAKsB,GALtB,GAMAD,oBANA,GAOA,GAPA,GAQA,GATD;AAWA;AACA;AACA;AACA;;AACA,IAAMG,qCAAqC,GAAG,IAAIC,MAAJ,CAAWF,6BAAX,EAA0C,GAA1C,CAA9C;AAGA;;AACA,IAAMG,SAAS,GAAGJ,YAAlB;AAEA,IAAMK,oBAAoB,GAAG,GAAA,GAAMD,SAAN,GAAkB,YAAlB,GAAiCA,SAAjC,GAA6C,KAA1E;AAEA,IAAME,YAAY,GAAG,QAArB;AACA,IAAMC,iBAAiB,GAAG,GAAA,GAAMD,YAAN,GAAqB,YAArB,GAAoCF,SAApC,GAAgD,KAA1E;AAEA,IAAMI,mBAAmB,GAAG,IAAA,GAAOH,oBAAP,GAA8B,OAA9B,GAAwCE,iBAAxC,GAA4D,OAAxF;AAEA;AACA;AACA;AACA;;AACA,IAAME,2BAA2B,GAAG,IAAIN,MAAJ,CAAWK,mBAAX,EAAgC,GAAhC,CAApC;AAEO,IAAME,eAAe,GAAG;AACxB,IAAMC,sBAAsB,GAAG;AAC/B,IAAMC,wBAAwB,GAAG;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,mBAATA,CAA6BC,mBAA7B,EAAkD;EAChE,IAAMC,mBAAmB,GAAGD,mBAAmB,CAACE,OAApB,CAA4BL,sBAA5B,CAA5B,CADgE;;EAGhE,IAAII,mBAAmB,GAAG,CAA1B,EAA6B;AAC5B,IAAA,OAAO,IAAP;AACA,EAAA;EAED,IAAME,iBAAiB,GAAGF,mBAAmB,GAAGJ,sBAAsB,CAACO,MAAvE,CAPgE;;AAShE,EAAA,IAAID,iBAAiB,IAAIH,mBAAmB,CAACI,MAA7C,EAAqD;AACpD,IAAA,OAAO,EAAP;AACA,EAAA;EAED,IAAMC,eAAe,GAAGL,mBAAmB,CAACE,OAApB,CAA4B,GAA5B,EAAiCC,iBAAjC,CAAxB,CAbgE;;EAehE,IAAIE,eAAe,IAAI,CAAvB,EAA0B;AACzB,IAAA,OAAOL,mBAAmB,CAACM,SAApB,CAA8BH,iBAA9B,EAAiDE,eAAjD,CAAP;AACA,EAAA,CAFD,MAEO;AACN,IAAA,OAAOL,mBAAmB,CAACM,SAApB,CAA8BH,iBAA9B,CAAP;AACA,EAAA;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACO,SAASI,mBAATA,CAA6BC,YAA7B,EAA2C;EACjD,IAAIA,YAAY,KAAK,IAArB,EAA2B;AAC1B,IAAA,OAAO,IAAP;AACA,EAAA;AAED,EAAA,IAAIA,YAAY,CAACJ,MAAb,KAAwB,CAA5B,EAA+B;AAC9B,IAAA,OAAO,KAAP;AACA,EAAA,CAPgD;;EAUjD,OAAOhB,qCAAqC,CAACqB,IAAtC,CAA2CD,YAA3C,CAAA,IACNb,2BAA2B,CAACc,IAA5B,CAAiCD,YAAjC,CADD;AAEA;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import applyInternationalSeparatorStyle from './applyInternationalSeparatorStyle.js';
|
|
2
2
|
|
|
3
|
-
// This was originally set to $1 but there are some countries for which the
|
|
4
3
|
// first group is not used in the national pattern (e.g. Argentina) so the $1
|
|
5
4
|
// group does not match correctly. Therefore, we use `\d`, so that the first
|
|
6
5
|
// group actually used in the pattern will be matched.
|
|
6
|
+
|
|
7
7
|
var FIRST_GROUP_PATTERN = /(\$\d)/;
|
|
8
8
|
function formatNationalNumberUsingFormat(number, format, _ref) {
|
|
9
9
|
var useInternationalFormat = _ref.useInternationalFormat,
|
package/lib/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatNationalNumberUsingFormat.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js"],"sourcesContent":["import applyInternationalSeparatorStyle from './applyInternationalSeparatorStyle.js'
|
|
1
|
+
{"version":3,"file":"formatNationalNumberUsingFormat.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js"],"sourcesContent":["import applyInternationalSeparatorStyle from './applyInternationalSeparatorStyle.js'; // This was originally set to $1 but there are some countries for which the\n// first group is not used in the national pattern (e.g. Argentina) so the $1\n// group does not match correctly. Therefore, we use `\\d`, so that the first\n// group actually used in the pattern will be matched.\n\nexport var FIRST_GROUP_PATTERN = /(\\$\\d)/;\nexport default function formatNationalNumberUsingFormat(number, format, _ref) {\n var useInternationalFormat = _ref.useInternationalFormat,\n withNationalPrefix = _ref.withNationalPrefix,\n carrierCode = _ref.carrierCode,\n metadata = _ref.metadata;\n var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`,\n // because that one is only used when formatting phone numbers\n // for dialing from a mobile phone, and this is not a dialing library.\n // carrierCode && format.domesticCarrierCodeFormattingRule()\n // \t// First, replace the $CC in the formatting rule with the desired carrier code.\n // \t// Then, replace the $FG in the formatting rule with the first group\n // \t// and the carrier code combined in the appropriate way.\n // \t? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))\n // \t: (\n // \t\twithNationalPrefix && format.nationalPrefixFormattingRule()\n // \t\t\t? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())\n // \t\t\t: format.format()\n // \t)\n withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());\n\n if (useInternationalFormat) {\n return applyInternationalSeparatorStyle(formattedNumber);\n }\n\n return formattedNumber;\n}\n//# sourceMappingURL=formatNationalNumberUsingFormat.js.map"],"names":["FIRST_GROUP_PATTERN","formatNationalNumberUsingFormat","number","format","_ref","useInternationalFormat","withNationalPrefix","carrierCode","metadata","formattedNumber","replace","RegExp","pattern","internationalFormat","nationalPrefixFormattingRule","applyInternationalSeparatorStyle"],"mappings":";;AAGA;AACA;AACA;;AACO,IAAMA,mBAAmB,GAAG;AAEpB,SAASC,+BAATA,CACdC,MADc,EAEdC,MAFc,EAAAC,IAAA,EASb;AAAA,EAAA,IALAC,sBAKA,GAAAD,IAAA,CALAC,sBAKA;IAJAC,kBAIA,GAAAF,IAAA,CAJAE,kBAIA;IAAAF,IAAA,CAHAG,WAGA;IAAAH,IAAA,CAFAI;EAGD,IAAMC,eAAe,GAAGP,MAAM,CAACQ,OAAP,CACvB,IAAIC,MAAJ,CAAWR,MAAM,CAACS,OAAP,EAAX,CADuB,EAEvBP,sBAAsB,GACnBF,MAAM,CAACU,mBAAP,EADmB;AAGpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACAP,kBAAkB,IAAIH,MAAM,CAACW,4BAAP,EAAtB,GACGX,MAAM,CAACA,MAAP,EAAA,CAAgBO,OAAhB,CAAwBV,mBAAxB,EAA6CG,MAAM,CAACW,4BAAP,EAA7C,CADH,GAEGX,MAAM,CAACA,MAAP,EApBkB,CAAxB;AAuBA,EAAA,IAAIE,sBAAJ,EAA4B;IAC3B,OAAOU,gCAAgC,CAACN,eAAD,CAAvC;AACA,EAAA;AACD,EAAA,OAAOA,eAAP;AACA;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import getCountryByNationalNumber from './getCountryByNationalNumber.js';
|
|
2
2
|
|
|
3
|
-
// Returns the exact country for the `nationalNumber`
|
|
4
|
-
// that belongs to the specified "country calling code".
|
|
5
3
|
function getCountryByCallingCode(callingCode, _ref) {
|
|
6
4
|
var nationalPhoneNumber = _ref.nationalNumber,
|
|
5
|
+
defaultCountry = _ref.defaultCountry,
|
|
7
6
|
metadata = _ref.metadata;
|
|
8
7
|
var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);
|
|
9
8
|
if (!possibleCountries) {
|
|
10
9
|
return;
|
|
11
|
-
}
|
|
12
|
-
// If there's just one country corresponding to the country code,
|
|
10
|
+
} // If there's just one country corresponding to the country code,
|
|
13
11
|
// then just return it, without further phone number digits validation.
|
|
12
|
+
|
|
14
13
|
if (possibleCountries.length === 1) {
|
|
15
14
|
return possibleCountries[0];
|
|
16
15
|
}
|
|
17
16
|
return getCountryByNationalNumber(nationalPhoneNumber, {
|
|
18
17
|
countries: possibleCountries,
|
|
18
|
+
defaultCountry: defaultCountry,
|
|
19
19
|
metadata: metadata.metadata
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCountryByCallingCode.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js"],"sourcesContent":["import getCountryByNationalNumber from './getCountryByNationalNumber.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\
|
|
1
|
+
{"version":3,"file":"getCountryByCallingCode.js","sources":["../../../../../node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js"],"sourcesContent":["import getCountryByNationalNumber from './getCountryByNationalNumber.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\nexport default function getCountryByCallingCode(callingCode, _ref) {\n var nationalPhoneNumber = _ref.nationalNumber,\n defaultCountry = _ref.defaultCountry,\n metadata = _ref.metadata;\n\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(callingCode)) {\n return '001';\n }\n }\n\n var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);\n\n if (!possibleCountries) {\n return;\n } // If there's just one country corresponding to the country code,\n // then just return it, without further phone number digits validation.\n\n\n if (possibleCountries.length === 1) {\n return possibleCountries[0];\n }\n\n return getCountryByNationalNumber(nationalPhoneNumber, {\n countries: possibleCountries,\n defaultCountry: defaultCountry,\n metadata: metadata.metadata\n });\n}\n//# sourceMappingURL=getCountryByCallingCode.js.map"],"names":["getCountryByCallingCode","callingCode","_ref","nationalPhoneNumber","nationalNumber","defaultCountry","metadata","possibleCountries","getCountryCodesForCallingCode","length","getCountryByNationalNumber","countries"],"mappings":";;AAIe,SAASA,uBAATA,CAAiCC,WAAjC,EAAAC,IAAA,EAIZ;AAAA,EAAA,IAHcC,mBAGd,GAAAD,IAAA,CAHFE,cAGE;IAFFC,cAEE,GAAAH,IAAA,CAFFG,cAEE;IADFC,QACE,GAAAJ,IAAA,CADFI,QACE;AAOF,EAAA,IAAMC,iBAAiB,GAAGD,QAAQ,CAACE,6BAAT,CAAuCP,WAAvC,CAA1B;EACA,IAAI,CAACM,iBAAL,EAAwB;AACvB,IAAA;AACA,EAAA,CAVC;AAYF;;AACA,EAAA,IAAIA,iBAAiB,CAACE,MAAlB,KAA6B,CAAjC,EAAoC;IACnC,OAAOF,iBAAiB,CAAC,CAAD,CAAxB;AACA,EAAA;EACD,OAAOG,0BAA0B,CAACP,mBAAD,EAAsB;AACtDQ,IAAAA,SAAS,EAAEJ,iBAD2C;AAEtDF,IAAAA,cAAc,EAAdA,cAFsD;IAGtDC,QAAQ,EAAEA,QAAQ,CAACA;AAHmC,GAAtB,CAAjC;AAKA;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,104 +1,80 @@
|
|
|
1
1
|
import Metadata from '../metadata.js';
|
|
2
2
|
import getNumberType from './getNumberType.js';
|
|
3
3
|
|
|
4
|
-
function _createForOfIteratorHelperLoose(
|
|
5
|
-
var
|
|
6
|
-
if (
|
|
7
|
-
if (Array.isArray(
|
|
8
|
-
|
|
9
|
-
var
|
|
4
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
5
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
6
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
7
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) {
|
|
8
|
+
if (it) o = it;
|
|
9
|
+
var i = 0;
|
|
10
10
|
return function () {
|
|
11
|
-
|
|
11
|
+
if (i >= o.length) return {
|
|
12
12
|
done: true
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
14
15
|
done: false,
|
|
15
|
-
value:
|
|
16
|
+
value: o[i++]
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
20
21
|
}
|
|
21
|
-
function _unsupportedIterableToArray(
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
23
|
+
if (!o) return;
|
|
24
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
25
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
26
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
27
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
28
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
27
29
|
}
|
|
28
|
-
function _arrayLikeToArray(
|
|
29
|
-
(
|
|
30
|
-
for (var
|
|
31
|
-
|
|
30
|
+
function _arrayLikeToArray(arr, len) {
|
|
31
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
32
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
33
|
+
arr2[i] = arr[i];
|
|
34
|
+
}
|
|
35
|
+
return arr2;
|
|
32
36
|
}
|
|
33
|
-
|
|
34
|
-
// Returns the exact country that the `nationalPhoneNumber` belongs to
|
|
35
|
-
// in cases of ambiguity, i.e. when multiple countries share the same "country calling code".
|
|
36
37
|
function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
|
37
|
-
var countries = _ref.countries
|
|
38
|
-
|
|
38
|
+
var countries = _ref.countries;
|
|
39
|
+
_ref.defaultCountry;
|
|
40
|
+
var metadata = _ref.metadata;
|
|
39
41
|
// Re-create `metadata` because it will be selecting a `country`.
|
|
40
|
-
metadata = new Metadata(metadata);
|
|
41
|
-
|
|
42
|
-
// const matchingCountries = []
|
|
42
|
+
metadata = new Metadata(metadata); // const matchingCountries = []
|
|
43
43
|
|
|
44
44
|
for (var _iterator = _createForOfIteratorHelperLoose(countries), _step; !(_step = _iterator()).done;) {
|
|
45
45
|
var country = _step.value;
|
|
46
|
-
metadata.
|
|
47
|
-
// "Leading digits" patterns are only defined for about 20% of all countries.
|
|
46
|
+
metadata.country(country); // "Leading digits" patterns are only defined for about 20% of all countries.
|
|
48
47
|
// By definition, matching "leading digits" is a sufficient but not a necessary
|
|
49
48
|
// condition for a phone number to belong to a country.
|
|
50
49
|
// The point of "leading digits" check is that it's the fastest one to get a match.
|
|
51
50
|
// https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits
|
|
52
51
|
// I'd suppose that "leading digits" patterns are mutually exclusive for different countries
|
|
53
52
|
// because of the intended use of that feature.
|
|
53
|
+
|
|
54
54
|
if (metadata.leadingDigits()) {
|
|
55
55
|
if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {
|
|
56
56
|
return country;
|
|
57
57
|
}
|
|
58
|
-
}
|
|
59
|
-
// Else perform full validation with all of those
|
|
58
|
+
} // Else perform full validation with all of those
|
|
60
59
|
// fixed-line/mobile/etc regular expressions.
|
|
61
60
|
else if (getNumberType({
|
|
62
61
|
phone: nationalPhoneNumber,
|
|
63
62
|
country: country
|
|
64
63
|
}, undefined, metadata.metadata)) {
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
// For example, both `US` and `CA` have the same pattern for `toll_free` numbers.
|
|
68
|
-
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417147572
|
|
69
|
-
//
|
|
70
|
-
// That means that this `if` condition could be `true` for multiple countries from the list.
|
|
71
|
-
// Currently, it just returns the first one, which is also the "main" country for the "country calling code".
|
|
72
|
-
// In an example with `toll_free` numbers above, `"US"` would be returned even though
|
|
73
|
-
// it could as well be `"CA"`.
|
|
74
|
-
//
|
|
75
|
-
// There was also a time when this attempted to be overly smart
|
|
76
|
-
// and kept track of all such multiple matching countries
|
|
77
|
-
// and then picked the one that matched the `defaultCountry`, if provided.
|
|
78
|
-
// For example, with `toll_free` numbers above, and with `defaultCountry: "CA"`,
|
|
79
|
-
// it would've returned `"CA"` instead of `"US"`.
|
|
80
|
-
// Later it turned out that such "overly smart" behavior turned out to be just confusing,
|
|
81
|
-
// so this "overly smart" country detection was reverted to returning the "main" country
|
|
82
|
-
// for the "country calling code".
|
|
64
|
+
// If both the `defaultCountry` and the "main" one match the phone number,
|
|
65
|
+
// don't prefer the `defaultCountry` over the "main" one.
|
|
83
66
|
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/154
|
|
84
|
-
//
|
|
85
|
-
return country;
|
|
86
|
-
//
|
|
87
|
-
// The "overly smart" behavior code:
|
|
88
|
-
//
|
|
67
|
+
return country; // // If the `defaultCountry` is among the `matchingCountries` then return it.
|
|
89
68
|
// if (defaultCountry) {
|
|
90
69
|
// if (country === defaultCountry) {
|
|
91
70
|
// return country
|
|
92
|
-
// } else {
|
|
93
|
-
// matchingCountries.push(country)
|
|
94
71
|
// }
|
|
72
|
+
// matchingCountries.push(country)
|
|
95
73
|
// } else {
|
|
96
74
|
// return country
|
|
97
75
|
// }
|
|
98
76
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// // Return the first ("main") one of the `matchingCountries`.
|
|
77
|
+
} // // Return the first ("main") one of the `matchingCountries`.
|
|
102
78
|
// if (matchingCountries.length > 0) {
|
|
103
79
|
// return matchingCountries[0]
|
|
104
80
|
// }
|