libphonenumber-js 1.9.28 → 1.9.32
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/core/index.d.ts +3 -1
- package/custom.d.ts +3 -1
- package/examples.mobile.json.d.ts +3 -7
- package/index.d.ts +3 -1
- package/min/index.d.ts +3 -1
- package/package.json +1 -1
- package/types.d.ts +7 -0
package/core/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
|
+
Examples,
|
|
3
4
|
PhoneNumber,
|
|
4
5
|
E164Number,
|
|
5
6
|
CountryCallingCode,
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
// https://github.com/catamphetamine/libphonenumber-js/pull/290#issuecomment-453281180
|
|
21
22
|
export {
|
|
22
23
|
MetadataJson,
|
|
24
|
+
Examples,
|
|
23
25
|
PhoneNumber,
|
|
24
26
|
E164Number,
|
|
25
27
|
CountryCallingCode,
|
|
@@ -83,7 +85,7 @@ export function getCountries(metadata: MetadataJson): CountryCode[];
|
|
|
83
85
|
export function getCountryCallingCode(countryCode: CountryCode, metadata: MetadataJson): CountryCallingCode;
|
|
84
86
|
export function getExtPrefix(countryCode: CountryCode, metadata: MetadataJson): string;
|
|
85
87
|
|
|
86
|
-
export function getExampleNumber(country: CountryCode, examples:
|
|
88
|
+
export function getExampleNumber(country: CountryCode, examples: Examples }, metadata: MetadataJson): PhoneNumber | undefined;
|
|
87
89
|
|
|
88
90
|
export function formatIncompletePhoneNumber(number: string, metadata: MetadataJson): string;
|
|
89
91
|
export function formatIncompletePhoneNumber(number: string, countryCode: CountryCode, metadata: MetadataJson): string;
|
package/custom.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
MetadataJson,
|
|
6
|
+
Examples,
|
|
6
7
|
PhoneNumber,
|
|
7
8
|
E164Number,
|
|
8
9
|
CountryCallingCode,
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
|
|
27
28
|
export {
|
|
28
29
|
MetadataJson,
|
|
30
|
+
Examples,
|
|
29
31
|
PhoneNumber,
|
|
30
32
|
E164Number,
|
|
31
33
|
CountryCallingCode,
|
|
@@ -83,7 +85,7 @@ export function getNumberType(parsedNumber: ParsedNumber, metadata: MetadataJson
|
|
|
83
85
|
export function getNumberType(phone: NationalNumber, metadata: MetadataJson): NumberType;
|
|
84
86
|
export function getNumberType(phone: NationalNumber, country: CountryCode, metadata: MetadataJson): NumberType;
|
|
85
87
|
|
|
86
|
-
export function getExampleNumber(country: CountryCode, examples:
|
|
88
|
+
export function getExampleNumber(country: CountryCode, examples: Examples, metadata: MetadataJson): PhoneNumber | undefined;
|
|
87
89
|
|
|
88
90
|
export function isPossibleNumber(parsedNumber: ParsedNumber, metadata: MetadataJson): boolean;
|
|
89
91
|
export function isPossibleNumber(phone: NationalNumber, metadata: MetadataJson): boolean;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Examples } from './types';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types
|
|
6
|
-
// `country in CountryCode` means "for each and every CountryCode".
|
|
7
|
-
[country in CountryCode]: E164Number;
|
|
8
|
-
};
|
|
3
|
+
declare const examples: Examples;
|
|
4
|
+
export default examples;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
|
+
Examples,
|
|
3
4
|
PhoneNumber,
|
|
4
5
|
E164Number,
|
|
5
6
|
CountryCallingCode,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
|
|
19
20
|
export {
|
|
20
21
|
MetadataJson,
|
|
22
|
+
Examples,
|
|
21
23
|
PhoneNumber,
|
|
22
24
|
E164Number,
|
|
23
25
|
CountryCallingCode,
|
|
@@ -96,7 +98,7 @@ export function formatNumber(phone: NationalNumber, country: CountryCode, format
|
|
|
96
98
|
export function getNumberType(parsedNumber: ParsedNumber): NumberType;
|
|
97
99
|
export function getNumberType(phone: NationalNumber, country?: CountryCode): NumberType;
|
|
98
100
|
|
|
99
|
-
export function getExampleNumber(country: CountryCode, examples:
|
|
101
|
+
export function getExampleNumber(country: CountryCode, examples: Examples): PhoneNumber | undefined;
|
|
100
102
|
|
|
101
103
|
export function isPossibleNumber(parsedNumber: ParsedNumber): boolean;
|
|
102
104
|
export function isPossibleNumber(phone: NationalNumber, country?: CountryCode): boolean;
|
package/min/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
|
+
Examples,
|
|
3
4
|
PhoneNumber,
|
|
4
5
|
E164Number,
|
|
5
6
|
CountryCallingCode,
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
// https://github.com/catamphetamine/libphonenumber-js/pull/290#issuecomment-453281180
|
|
21
22
|
export {
|
|
22
23
|
MetadataJson,
|
|
24
|
+
Examples,
|
|
23
25
|
PhoneNumber,
|
|
24
26
|
E164Number,
|
|
25
27
|
CountryCallingCode,
|
|
@@ -71,7 +73,7 @@ export function getCountries(): CountryCode[];
|
|
|
71
73
|
export function getCountryCallingCode(countryCode: CountryCode): CountryCallingCode;
|
|
72
74
|
export function getExtPrefix(countryCode: CountryCode): string;
|
|
73
75
|
|
|
74
|
-
export function getExampleNumber(country: CountryCode, examples:
|
|
76
|
+
export function getExampleNumber(country: CountryCode, examples: Examples): PhoneNumber | undefined;
|
|
75
77
|
|
|
76
78
|
export function formatIncompletePhoneNumber(number: string, countryCode?: CountryCode): string;
|
|
77
79
|
export function parseIncompletePhoneNumber(text: string): string;
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -32,6 +32,13 @@ export type MetadataJson = {
|
|
|
32
32
|
countries: Countries;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
export type Examples = {
|
|
36
|
+
// `in` operator docs:
|
|
37
|
+
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types
|
|
38
|
+
// `country in CountryCode` means "for each and every CountryCode".
|
|
39
|
+
[country in CountryCode]: NationalNumber;
|
|
40
|
+
};
|
|
41
|
+
|
|
35
42
|
// 'National' and 'International' formats are deprecated.
|
|
36
43
|
export type NumberFormat = 'NATIONAL' | 'National' | 'INTERNATIONAL' | 'International' | 'E.164' | 'RFC3966' | 'IDD';
|
|
37
44
|
export type NumberType = undefined | 'PREMIUM_RATE' | 'TOLL_FREE' | 'SHARED_COST' | 'VOIP' | 'PERSONAL_NUMBER' | 'PAGER' | 'UAN' | 'VOICEMAIL' | 'FIXED_LINE_OR_MOBILE' | 'FIXED_LINE' | 'MOBILE';
|