libphonenumber-js 1.12.33 → 1.12.35

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +30 -18
  2. package/README.md +3 -1
  3. package/build/format.js +18 -2
  4. package/build/format.js.map +1 -1
  5. package/build/format.test.js +3 -6
  6. package/build/format.test.js.map +1 -1
  7. package/build/helpers/getIddPrefix.js +2 -2
  8. package/build/helpers/getIddPrefix.js.map +1 -1
  9. package/build/legacy/format.test.js +3 -6
  10. package/build/legacy/format.test.js.map +1 -1
  11. package/bundle/libphonenumber-js.min.js +1 -1
  12. package/bundle/libphonenumber-js.min.js.map +1 -1
  13. package/bundle/libphonenumber-max.js +1 -1
  14. package/bundle/libphonenumber-max.js.map +1 -1
  15. package/bundle/libphonenumber-min.js +1 -1
  16. package/bundle/libphonenumber-min.js.map +1 -1
  17. package/bundle/libphonenumber-mobile.js +1 -1
  18. package/bundle/libphonenumber-mobile.js.map +1 -1
  19. package/core/index.d.cts +12 -4
  20. package/core/index.d.ts +12 -4
  21. package/custom.d.ts +7 -6
  22. package/es6/format.js +18 -2
  23. package/es6/format.js.map +1 -1
  24. package/es6/format.test.js +3 -6
  25. package/es6/format.test.js.map +1 -1
  26. package/es6/helpers/getIddPrefix.js +2 -2
  27. package/es6/helpers/getIddPrefix.js.map +1 -1
  28. package/es6/legacy/format.test.js +3 -6
  29. package/es6/legacy/format.test.js.map +1 -1
  30. package/index.d.cts +6 -4
  31. package/index.d.ts +6 -4
  32. package/max/index.d.cts +12 -4
  33. package/max/index.d.ts +12 -4
  34. package/max/metadata/metadata.max.json +1 -1
  35. package/max/metadata/metadata.max.json.js +1 -1
  36. package/metadata.full.json +1 -1
  37. package/metadata.full.json.js +1 -1
  38. package/metadata.max.json +1 -1
  39. package/metadata.max.json.js +1 -1
  40. package/metadata.min.json +1 -1
  41. package/metadata.min.json.js +1 -1
  42. package/metadata.mobile.json +1 -1
  43. package/metadata.mobile.json.js +1 -1
  44. package/min/index.d.cts +12 -4
  45. package/min/index.d.ts +12 -4
  46. package/min/metadata/metadata.min.json +1 -1
  47. package/min/metadata/metadata.min.json.js +1 -1
  48. package/mobile/index.d.cts +12 -4
  49. package/mobile/index.d.ts +12 -4
  50. package/mobile/metadata/metadata.mobile.json +1 -1
  51. package/mobile/metadata/metadata.mobile.json.js +1 -1
  52. package/package.json +1 -1
  53. package/source/format.js +17 -2
  54. package/source/format.test.js +3 -3
  55. package/source/helpers/getIddPrefix.js +2 -2
  56. package/source/legacy/format.test.js +3 -3
  57. package/types.d.cts +21 -10
  58. package/types.d.ts +21 -10
package/max/index.d.cts CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  NumberFormat,
14
14
  NumberingPlan,
15
15
  FormatNumberOptions,
16
- FormatNumberOptionsWithoutIDD,
16
+ FormatNumberOptionsForNationalOrInternational,
17
17
  ValidatePhoneNumberLengthResult
18
18
  } from '../types.d.cjs';
19
19
 
@@ -50,9 +50,9 @@ export class PhoneNumber {
50
50
  isValid(): boolean;
51
51
  getType(): NumberType;
52
52
  format(format: NumberFormat, options?: FormatNumberOptions): string;
53
- formatNational(options?: FormatNumberOptionsWithoutIDD): string;
54
- formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
55
- getURI(options?: FormatNumberOptionsWithoutIDD): string;
53
+ formatNational(options?: FormatNumberOptionsForNationalOrInternational): string;
54
+ formatInternational(options?: FormatNumberOptionsForNationalOrInternational): string;
55
+ getURI(): string;
56
56
  isNonGeographic(): boolean;
57
57
  isEqual(phoneNumber: PhoneNumber): boolean;
58
58
  }
@@ -78,9 +78,15 @@ export function isValidPhoneNumber(text: string, defaultCountry?: CountryCode |
78
78
  export function isPossiblePhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
79
79
  export function validatePhoneNumberLength(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): ValidatePhoneNumberLengthResult | undefined;
80
80
 
81
+ /**
82
+ * @deprecated
83
+ */
81
84
  export function findNumbers(text: string, options?: CountryCode): NumberFoundLegacy[];
82
85
  export function searchNumbers(text: string, options?: CountryCode): IterableIterator<NumberFoundLegacy>;
83
86
 
87
+ /**
88
+ * @deprecated
89
+ */
84
90
  export function findNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): NumberFound[];
85
91
  export function searchNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): IterableIterator<NumberFound>;
86
92
 
@@ -88,6 +94,8 @@ export function findPhoneNumbersInText(text: string, options?: CountryCode | { d
88
94
  export function searchPhoneNumbersInText(text: string, options?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string, extended?: boolean }): IterableIterator<NumberFound>;
89
95
 
90
96
  export class PhoneNumberMatcher {
97
+ // The `v2: true` parameter only exists for legacy reasons and should always be specified.
98
+ // It tells it to include the parsed E.164 `number` property in the result.
91
99
  constructor(text: string, options?: { defaultCountry?: CountryCode, v2: true });
92
100
  hasNext(): boolean;
93
101
  next(): NumberFound | undefined;
package/max/index.d.ts CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  NumberFormat,
14
14
  NumberingPlan,
15
15
  FormatNumberOptions,
16
- FormatNumberOptionsWithoutIDD,
16
+ FormatNumberOptionsForNationalOrInternational,
17
17
  ValidatePhoneNumberLengthResult
18
18
  } from '../types.d.js';
19
19
 
@@ -50,9 +50,9 @@ export class PhoneNumber {
50
50
  isValid(): boolean;
51
51
  getType(): NumberType;
52
52
  format(format: NumberFormat, options?: FormatNumberOptions): string;
53
- formatNational(options?: FormatNumberOptionsWithoutIDD): string;
54
- formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
55
- getURI(options?: FormatNumberOptionsWithoutIDD): string;
53
+ formatNational(options?: FormatNumberOptionsForNationalOrInternational): string;
54
+ formatInternational(options?: FormatNumberOptionsForNationalOrInternational): string;
55
+ getURI(): string;
56
56
  isNonGeographic(): boolean;
57
57
  isEqual(phoneNumber: PhoneNumber): boolean;
58
58
  }
@@ -78,9 +78,15 @@ export function isValidPhoneNumber(text: string, defaultCountry?: CountryCode |
78
78
  export function isPossiblePhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
79
79
  export function validatePhoneNumberLength(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): ValidatePhoneNumberLengthResult | undefined;
80
80
 
81
+ /**
82
+ * @deprecated
83
+ */
81
84
  export function findNumbers(text: string, options?: CountryCode): NumberFoundLegacy[];
82
85
  export function searchNumbers(text: string, options?: CountryCode): IterableIterator<NumberFoundLegacy>;
83
86
 
87
+ /**
88
+ * @deprecated
89
+ */
84
90
  export function findNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): NumberFound[];
85
91
  export function searchNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): IterableIterator<NumberFound>;
86
92
 
@@ -88,6 +94,8 @@ export function findPhoneNumbersInText(text: string, options?: CountryCode | { d
88
94
  export function searchPhoneNumbersInText(text: string, options?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string, extended?: boolean }): IterableIterator<NumberFound>;
89
95
 
90
96
  export class PhoneNumberMatcher {
97
+ // The `v2: true` parameter only exists for legacy reasons and should always be specified.
98
+ // It tells it to include the parsed E.164 `number` property in the result.
91
99
  constructor(text: string, options?: { defaultCountry?: CountryCode, v2: true });
92
100
  hasNext(): boolean;
93
101
  next(): NumberFound | undefined;