libphonenumber-js 1.12.0 → 1.12.1
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.cts +24 -6
- package/core/index.d.ts +24 -6
- package/custom.d.ts +24 -4
- package/index.d.cts +24 -4
- package/index.d.ts +24 -4
- package/max/index.d.cts +24 -4
- package/max/index.d.ts +24 -4
- package/min/index.d.cts +24 -4
- package/min/index.d.ts +24 -4
- package/mobile/index.d.cts +24 -4
- package/mobile/index.d.ts +24 -4
- package/package.json +1 -1
- package/types.d.cts +33 -25
- package/types.d.ts +33 -25
package/core/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -30,17 +28,37 @@ export {
|
|
|
30
28
|
Extension,
|
|
31
29
|
ParseError,
|
|
32
30
|
NumberFoundLegacy,
|
|
33
|
-
NumberFound,
|
|
34
31
|
NumberType,
|
|
35
32
|
NumberFormat,
|
|
36
33
|
NumberingPlan,
|
|
37
34
|
ValidatePhoneNumberLengthResult
|
|
38
35
|
};
|
|
39
36
|
|
|
40
|
-
export class PhoneNumber
|
|
37
|
+
export class PhoneNumber {
|
|
41
38
|
constructor(number: E164Number, metadata: MetadataJson);
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
countryCallingCode: CountryCallingCode;
|
|
40
|
+
country?: CountryCode;
|
|
41
|
+
nationalNumber: NationalNumber;
|
|
42
|
+
number: E164Number;
|
|
43
|
+
carrierCode?: CarrierCode;
|
|
44
|
+
ext?: Extension;
|
|
45
|
+
setExt(ext: Extension): void;
|
|
46
|
+
getPossibleCountries(): CountryCode[];
|
|
47
|
+
isPossible(): boolean;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
getType(): NumberType;
|
|
50
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
51
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
53
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
54
|
+
isNonGeographic(): boolean;
|
|
55
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NumberFound {
|
|
59
|
+
number: PhoneNumber;
|
|
60
|
+
startsAt: number;
|
|
61
|
+
endsAt: number;
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/core/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -30,17 +28,37 @@ export {
|
|
|
30
28
|
Extension,
|
|
31
29
|
ParseError,
|
|
32
30
|
NumberFoundLegacy,
|
|
33
|
-
NumberFound,
|
|
34
31
|
NumberType,
|
|
35
32
|
NumberFormat,
|
|
36
33
|
NumberingPlan,
|
|
37
34
|
ValidatePhoneNumberLengthResult
|
|
38
35
|
};
|
|
39
36
|
|
|
40
|
-
export class PhoneNumber
|
|
37
|
+
export class PhoneNumber {
|
|
41
38
|
constructor(number: E164Number, metadata: MetadataJson);
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
countryCallingCode: CountryCallingCode;
|
|
40
|
+
country?: CountryCode;
|
|
41
|
+
nationalNumber: NationalNumber;
|
|
42
|
+
number: E164Number;
|
|
43
|
+
carrierCode?: CarrierCode;
|
|
44
|
+
ext?: Extension;
|
|
45
|
+
setExt(ext: Extension): void;
|
|
46
|
+
getPossibleCountries(): CountryCode[];
|
|
47
|
+
isPossible(): boolean;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
getType(): NumberType;
|
|
50
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
51
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
53
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
54
|
+
isNonGeographic(): boolean;
|
|
55
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NumberFound {
|
|
59
|
+
number: PhoneNumber;
|
|
60
|
+
startsAt: number;
|
|
61
|
+
endsAt: number;
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/custom.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import {
|
|
5
5
|
MetadataJson,
|
|
6
6
|
Examples,
|
|
7
|
-
PhoneNumber as IPhoneNumber,
|
|
8
7
|
E164Number,
|
|
9
8
|
CountryCallingCode,
|
|
10
9
|
CountryCode,
|
|
@@ -13,7 +12,6 @@ import {
|
|
|
13
12
|
Extension,
|
|
14
13
|
ParseError,
|
|
15
14
|
NumberFoundLegacy,
|
|
16
|
-
NumberFound,
|
|
17
15
|
NumberType,
|
|
18
16
|
NumberFormat,
|
|
19
17
|
NumberingPlan
|
|
@@ -39,14 +37,36 @@ export {
|
|
|
39
37
|
ParseNumberOptions,
|
|
40
38
|
ParseError,
|
|
41
39
|
NumberFoundLegacy,
|
|
42
|
-
NumberFound,
|
|
43
40
|
NumberFormat,
|
|
44
41
|
NumberType,
|
|
45
42
|
NumberingPlan
|
|
46
43
|
};
|
|
47
44
|
|
|
48
|
-
export class PhoneNumber
|
|
45
|
+
export class PhoneNumber {
|
|
49
46
|
constructor(number: E164Number, metadata: MetadataJson);
|
|
47
|
+
countryCallingCode: CountryCallingCode;
|
|
48
|
+
country?: CountryCode;
|
|
49
|
+
nationalNumber: NationalNumber;
|
|
50
|
+
number: E164Number;
|
|
51
|
+
carrierCode?: CarrierCode;
|
|
52
|
+
ext?: Extension;
|
|
53
|
+
setExt(ext: Extension): void;
|
|
54
|
+
getPossibleCountries(): CountryCode[];
|
|
55
|
+
isPossible(): boolean;
|
|
56
|
+
isValid(): boolean;
|
|
57
|
+
getType(): NumberType;
|
|
58
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
59
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
60
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
61
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
62
|
+
isNonGeographic(): boolean;
|
|
63
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface NumberFound {
|
|
67
|
+
number: PhoneNumber;
|
|
68
|
+
startsAt: number;
|
|
69
|
+
endsAt: number;
|
|
50
70
|
}
|
|
51
71
|
|
|
52
72
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -28,15 +26,37 @@ export {
|
|
|
28
26
|
Extension,
|
|
29
27
|
ParseError,
|
|
30
28
|
NumberFoundLegacy,
|
|
31
|
-
NumberFound,
|
|
32
29
|
NumberFormat,
|
|
33
30
|
NumberType,
|
|
34
31
|
NumberingPlan,
|
|
35
32
|
ValidatePhoneNumberLengthResult
|
|
36
33
|
};
|
|
37
34
|
|
|
38
|
-
export class PhoneNumber
|
|
35
|
+
export class PhoneNumber {
|
|
39
36
|
constructor(number: E164Number);
|
|
37
|
+
countryCallingCode: CountryCallingCode;
|
|
38
|
+
country?: CountryCode;
|
|
39
|
+
nationalNumber: NationalNumber;
|
|
40
|
+
number: E164Number;
|
|
41
|
+
carrierCode?: CarrierCode;
|
|
42
|
+
ext?: Extension;
|
|
43
|
+
setExt(ext: Extension): void;
|
|
44
|
+
getPossibleCountries(): CountryCode[];
|
|
45
|
+
isPossible(): boolean;
|
|
46
|
+
isValid(): boolean;
|
|
47
|
+
getType(): NumberType;
|
|
48
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
49
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
50
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
51
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
isNonGeographic(): boolean;
|
|
53
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface NumberFound {
|
|
57
|
+
number: PhoneNumber;
|
|
58
|
+
startsAt: number;
|
|
59
|
+
endsAt: number;
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
// `parsePhoneNumberFromString()` named export is now considered legacy:
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -28,15 +26,37 @@ export {
|
|
|
28
26
|
Extension,
|
|
29
27
|
ParseError,
|
|
30
28
|
NumberFoundLegacy,
|
|
31
|
-
NumberFound,
|
|
32
29
|
NumberFormat,
|
|
33
30
|
NumberType,
|
|
34
31
|
NumberingPlan,
|
|
35
32
|
ValidatePhoneNumberLengthResult
|
|
36
33
|
};
|
|
37
34
|
|
|
38
|
-
export class PhoneNumber
|
|
35
|
+
export class PhoneNumber {
|
|
39
36
|
constructor(number: E164Number);
|
|
37
|
+
countryCallingCode: CountryCallingCode;
|
|
38
|
+
country?: CountryCode;
|
|
39
|
+
nationalNumber: NationalNumber;
|
|
40
|
+
number: E164Number;
|
|
41
|
+
carrierCode?: CarrierCode;
|
|
42
|
+
ext?: Extension;
|
|
43
|
+
setExt(ext: Extension): void;
|
|
44
|
+
getPossibleCountries(): CountryCode[];
|
|
45
|
+
isPossible(): boolean;
|
|
46
|
+
isValid(): boolean;
|
|
47
|
+
getType(): NumberType;
|
|
48
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
49
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
50
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
51
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
isNonGeographic(): boolean;
|
|
53
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface NumberFound {
|
|
57
|
+
number: PhoneNumber;
|
|
58
|
+
startsAt: number;
|
|
59
|
+
endsAt: number;
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
// `parsePhoneNumberFromString()` named export is now considered legacy:
|
package/max/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -30,15 +28,37 @@ export {
|
|
|
30
28
|
Extension,
|
|
31
29
|
ParseError,
|
|
32
30
|
NumberFoundLegacy,
|
|
33
|
-
NumberFound,
|
|
34
31
|
NumberType,
|
|
35
32
|
NumberFormat,
|
|
36
33
|
NumberingPlan,
|
|
37
34
|
ValidatePhoneNumberLengthResult
|
|
38
35
|
};
|
|
39
36
|
|
|
40
|
-
export class PhoneNumber
|
|
37
|
+
export class PhoneNumber {
|
|
41
38
|
constructor(number: E164Number);
|
|
39
|
+
countryCallingCode: CountryCallingCode;
|
|
40
|
+
country?: CountryCode;
|
|
41
|
+
nationalNumber: NationalNumber;
|
|
42
|
+
number: E164Number;
|
|
43
|
+
carrierCode?: CarrierCode;
|
|
44
|
+
ext?: Extension;
|
|
45
|
+
setExt(ext: Extension): void;
|
|
46
|
+
getPossibleCountries(): CountryCode[];
|
|
47
|
+
isPossible(): boolean;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
getType(): NumberType;
|
|
50
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
51
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
53
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
54
|
+
isNonGeographic(): boolean;
|
|
55
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NumberFound {
|
|
59
|
+
number: PhoneNumber;
|
|
60
|
+
startsAt: number;
|
|
61
|
+
endsAt: number;
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/max/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -30,15 +28,37 @@ export {
|
|
|
30
28
|
Extension,
|
|
31
29
|
ParseError,
|
|
32
30
|
NumberFoundLegacy,
|
|
33
|
-
NumberFound,
|
|
34
31
|
NumberType,
|
|
35
32
|
NumberFormat,
|
|
36
33
|
NumberingPlan,
|
|
37
34
|
ValidatePhoneNumberLengthResult
|
|
38
35
|
};
|
|
39
36
|
|
|
40
|
-
export class PhoneNumber
|
|
37
|
+
export class PhoneNumber {
|
|
41
38
|
constructor(number: E164Number);
|
|
39
|
+
countryCallingCode: CountryCallingCode;
|
|
40
|
+
country?: CountryCode;
|
|
41
|
+
nationalNumber: NationalNumber;
|
|
42
|
+
number: E164Number;
|
|
43
|
+
carrierCode?: CarrierCode;
|
|
44
|
+
ext?: Extension;
|
|
45
|
+
setExt(ext: Extension): void;
|
|
46
|
+
getPossibleCountries(): CountryCode[];
|
|
47
|
+
isPossible(): boolean;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
getType(): NumberType;
|
|
50
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
51
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
53
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
54
|
+
isNonGeographic(): boolean;
|
|
55
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NumberFound {
|
|
59
|
+
number: PhoneNumber;
|
|
60
|
+
startsAt: number;
|
|
61
|
+
endsAt: number;
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/min/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -30,15 +28,37 @@ export {
|
|
|
30
28
|
Extension,
|
|
31
29
|
ParseError,
|
|
32
30
|
NumberFoundLegacy,
|
|
33
|
-
NumberFound,
|
|
34
31
|
NumberType,
|
|
35
32
|
NumberFormat,
|
|
36
33
|
NumberingPlan,
|
|
37
34
|
ValidatePhoneNumberLengthResult
|
|
38
35
|
};
|
|
39
36
|
|
|
40
|
-
export class PhoneNumber
|
|
37
|
+
export class PhoneNumber {
|
|
41
38
|
constructor(number: E164Number);
|
|
39
|
+
countryCallingCode: CountryCallingCode;
|
|
40
|
+
country?: CountryCode;
|
|
41
|
+
nationalNumber: NationalNumber;
|
|
42
|
+
number: E164Number;
|
|
43
|
+
carrierCode?: CarrierCode;
|
|
44
|
+
ext?: Extension;
|
|
45
|
+
setExt(ext: Extension): void;
|
|
46
|
+
getPossibleCountries(): CountryCode[];
|
|
47
|
+
isPossible(): boolean;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
getType(): NumberType;
|
|
50
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
51
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
53
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
54
|
+
isNonGeographic(): boolean;
|
|
55
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NumberFound {
|
|
59
|
+
number: PhoneNumber;
|
|
60
|
+
startsAt: number;
|
|
61
|
+
endsAt: number;
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/min/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -30,15 +28,37 @@ export {
|
|
|
30
28
|
Extension,
|
|
31
29
|
ParseError,
|
|
32
30
|
NumberFoundLegacy,
|
|
33
|
-
NumberFound,
|
|
34
31
|
NumberType,
|
|
35
32
|
NumberFormat,
|
|
36
33
|
NumberingPlan,
|
|
37
34
|
ValidatePhoneNumberLengthResult
|
|
38
35
|
};
|
|
39
36
|
|
|
40
|
-
export class PhoneNumber
|
|
37
|
+
export class PhoneNumber {
|
|
41
38
|
constructor(number: E164Number);
|
|
39
|
+
countryCallingCode: CountryCallingCode;
|
|
40
|
+
country?: CountryCode;
|
|
41
|
+
nationalNumber: NationalNumber;
|
|
42
|
+
number: E164Number;
|
|
43
|
+
carrierCode?: CarrierCode;
|
|
44
|
+
ext?: Extension;
|
|
45
|
+
setExt(ext: Extension): void;
|
|
46
|
+
getPossibleCountries(): CountryCode[];
|
|
47
|
+
isPossible(): boolean;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
getType(): NumberType;
|
|
50
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
51
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
53
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
54
|
+
isNonGeographic(): boolean;
|
|
55
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NumberFound {
|
|
59
|
+
number: PhoneNumber;
|
|
60
|
+
startsAt: number;
|
|
61
|
+
endsAt: number;
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/mobile/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -30,15 +28,37 @@ export {
|
|
|
30
28
|
Extension,
|
|
31
29
|
ParseError,
|
|
32
30
|
NumberFoundLegacy,
|
|
33
|
-
NumberFound,
|
|
34
31
|
NumberType,
|
|
35
32
|
NumberFormat,
|
|
36
33
|
NumberingPlan,
|
|
37
34
|
ValidatePhoneNumberLengthResult
|
|
38
35
|
};
|
|
39
36
|
|
|
40
|
-
export class PhoneNumber
|
|
37
|
+
export class PhoneNumber {
|
|
41
38
|
constructor(number: E164Number);
|
|
39
|
+
countryCallingCode: CountryCallingCode;
|
|
40
|
+
country?: CountryCode;
|
|
41
|
+
nationalNumber: NationalNumber;
|
|
42
|
+
number: E164Number;
|
|
43
|
+
carrierCode?: CarrierCode;
|
|
44
|
+
ext?: Extension;
|
|
45
|
+
setExt(ext: Extension): void;
|
|
46
|
+
getPossibleCountries(): CountryCode[];
|
|
47
|
+
isPossible(): boolean;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
getType(): NumberType;
|
|
50
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
51
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
53
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
54
|
+
isNonGeographic(): boolean;
|
|
55
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NumberFound {
|
|
59
|
+
number: PhoneNumber;
|
|
60
|
+
startsAt: number;
|
|
61
|
+
endsAt: number;
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/mobile/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MetadataJson,
|
|
3
3
|
Examples,
|
|
4
|
-
PhoneNumber as IPhoneNumber,
|
|
5
4
|
E164Number,
|
|
6
5
|
CountryCallingCode,
|
|
7
6
|
CountryCode,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
Extension,
|
|
11
10
|
ParseError,
|
|
12
11
|
NumberFoundLegacy,
|
|
13
|
-
NumberFound,
|
|
14
12
|
NumberType,
|
|
15
13
|
NumberFormat,
|
|
16
14
|
NumberingPlan,
|
|
@@ -30,15 +28,37 @@ export {
|
|
|
30
28
|
Extension,
|
|
31
29
|
ParseError,
|
|
32
30
|
NumberFoundLegacy,
|
|
33
|
-
NumberFound,
|
|
34
31
|
NumberType,
|
|
35
32
|
NumberFormat,
|
|
36
33
|
NumberingPlan,
|
|
37
34
|
ValidatePhoneNumberLengthResult
|
|
38
35
|
};
|
|
39
36
|
|
|
40
|
-
export class PhoneNumber
|
|
37
|
+
export class PhoneNumber {
|
|
41
38
|
constructor(number: E164Number);
|
|
39
|
+
countryCallingCode: CountryCallingCode;
|
|
40
|
+
country?: CountryCode;
|
|
41
|
+
nationalNumber: NationalNumber;
|
|
42
|
+
number: E164Number;
|
|
43
|
+
carrierCode?: CarrierCode;
|
|
44
|
+
ext?: Extension;
|
|
45
|
+
setExt(ext: Extension): void;
|
|
46
|
+
getPossibleCountries(): CountryCode[];
|
|
47
|
+
isPossible(): boolean;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
getType(): NumberType;
|
|
50
|
+
format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
51
|
+
formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
52
|
+
formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
53
|
+
getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
54
|
+
isNonGeographic(): boolean;
|
|
55
|
+
isEqual(phoneNumber: PhoneNumber): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NumberFound {
|
|
59
|
+
number: PhoneNumber;
|
|
60
|
+
startsAt: number;
|
|
61
|
+
endsAt: number;
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
|
package/package.json
CHANGED
package/types.d.cts
CHANGED
|
@@ -107,31 +107,39 @@ type FormatNumberOptions = {
|
|
|
107
107
|
// // https://stackoverflow.com/a/67026991
|
|
108
108
|
// type ArrayOfAtLeastOneCountryCode = [CountryCode, ...CountryCode[]];
|
|
109
109
|
|
|
110
|
-
export
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
110
|
+
// For some weird reason, `export class PhoneNumber implements IPhoneNumber {}` approach
|
|
111
|
+
// didn't work, so the declaration of the `PhoneNumber` class had to be copy-pasted everywhere
|
|
112
|
+
// instead of being declared once in this file.
|
|
113
|
+
//
|
|
114
|
+
// export interface PhoneNumber {
|
|
115
|
+
// countryCallingCode: CountryCallingCode;
|
|
116
|
+
// country?: CountryCode;
|
|
117
|
+
// nationalNumber: NationalNumber;
|
|
118
|
+
// number: E164Number;
|
|
119
|
+
// carrierCode?: CarrierCode;
|
|
120
|
+
// ext?: Extension;
|
|
121
|
+
// setExt(ext: Extension): void;
|
|
122
|
+
// getPossibleCountries(): CountryCode[];
|
|
123
|
+
// isPossible(): boolean;
|
|
124
|
+
// isValid(): boolean;
|
|
125
|
+
// getType(): NumberType;
|
|
126
|
+
// format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
127
|
+
// formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
128
|
+
// formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
129
|
+
// getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
130
|
+
// isNonGeographic(): boolean;
|
|
131
|
+
// isEqual(phoneNumber: PhoneNumber): boolean;
|
|
132
|
+
// }
|
|
133
|
+
//
|
|
134
|
+
// Because `PhoneNumber` interface was commented out,
|
|
135
|
+
// `NumberFound` also had to be copy-pasted everywhere
|
|
136
|
+
// instead of being declared once in this file.
|
|
137
|
+
//
|
|
138
|
+
// export interface NumberFound {
|
|
139
|
+
// number: PhoneNumber;
|
|
140
|
+
// startsAt: number;
|
|
141
|
+
// endsAt: number;
|
|
142
|
+
// }
|
|
135
143
|
|
|
136
144
|
// Deprecated
|
|
137
145
|
export interface NumberFoundLegacy {
|
package/types.d.ts
CHANGED
|
@@ -107,31 +107,39 @@ type FormatNumberOptions = {
|
|
|
107
107
|
// // https://stackoverflow.com/a/67026991
|
|
108
108
|
// type ArrayOfAtLeastOneCountryCode = [CountryCode, ...CountryCode[]];
|
|
109
109
|
|
|
110
|
-
export
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
110
|
+
// For some weird reason, `export class PhoneNumber implements IPhoneNumber {}` approach
|
|
111
|
+
// didn't work, so the declaration of the `PhoneNumber` class had to be copy-pasted everywhere
|
|
112
|
+
// instead of being declared once in this file.
|
|
113
|
+
//
|
|
114
|
+
// export interface PhoneNumber {
|
|
115
|
+
// countryCallingCode: CountryCallingCode;
|
|
116
|
+
// country?: CountryCode;
|
|
117
|
+
// nationalNumber: NationalNumber;
|
|
118
|
+
// number: E164Number;
|
|
119
|
+
// carrierCode?: CarrierCode;
|
|
120
|
+
// ext?: Extension;
|
|
121
|
+
// setExt(ext: Extension): void;
|
|
122
|
+
// getPossibleCountries(): CountryCode[];
|
|
123
|
+
// isPossible(): boolean;
|
|
124
|
+
// isValid(): boolean;
|
|
125
|
+
// getType(): NumberType;
|
|
126
|
+
// format(format: NumberFormat, options?: FormatNumberOptions): string;
|
|
127
|
+
// formatNational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
128
|
+
// formatInternational(options?: FormatNumberOptionsWithoutIDD): string;
|
|
129
|
+
// getURI(options?: FormatNumberOptionsWithoutIDD): string;
|
|
130
|
+
// isNonGeographic(): boolean;
|
|
131
|
+
// isEqual(phoneNumber: PhoneNumber): boolean;
|
|
132
|
+
// }
|
|
133
|
+
//
|
|
134
|
+
// Because `PhoneNumber` interface was commented out,
|
|
135
|
+
// `NumberFound` also had to be copy-pasted everywhere
|
|
136
|
+
// instead of being declared once in this file.
|
|
137
|
+
//
|
|
138
|
+
// export interface NumberFound {
|
|
139
|
+
// number: PhoneNumber;
|
|
140
|
+
// startsAt: number;
|
|
141
|
+
// endsAt: number;
|
|
142
|
+
// }
|
|
135
143
|
|
|
136
144
|
// Deprecated
|
|
137
145
|
export interface NumberFoundLegacy {
|