libphonenumber-js 1.13.4 → 1.13.6
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/.gitlab-ci.yml +22 -4
- package/CHANGELOG.md +28 -15
- package/build/helpers/checkNumberLength.test.js.map +1 -1
- package/bundle/libphonenumber-js.min.js +1 -1
- package/bundle/libphonenumber-js.min.js.map +1 -1
- package/bundle/libphonenumber-max.js +1 -1
- package/bundle/libphonenumber-max.js.map +1 -1
- package/bundle/libphonenumber-min.js +1 -1
- package/bundle/libphonenumber-min.js.map +1 -1
- package/bundle/libphonenumber-mobile.js +1 -1
- package/bundle/libphonenumber-mobile.js.map +1 -1
- package/es6/helpers/checkNumberLength.test.js.map +1 -1
- package/es6-modern/helpers/checkNumberLength.test.js.map +1 -1
- package/max/metadata/metadata.max.json +1 -1
- package/max/metadata/metadata.max.json.js +1 -1
- package/metadata.full.json +1 -1
- package/metadata.full.json.js +1 -1
- package/metadata.max.json +1 -1
- package/metadata.max.json.js +1 -1
- package/metadata.min.json +1 -1
- package/metadata.min.json.js +1 -1
- package/metadata.mobile.json +1 -1
- package/metadata.mobile.json.js +1 -1
- package/min/metadata/metadata.min.json +1 -1
- package/min/metadata/metadata.min.json.js +1 -1
- package/mobile/metadata/metadata.mobile.json +1 -1
- package/mobile/metadata/metadata.mobile.json.js +1 -1
- package/package.json +1 -1
- package/types.d.cts +5 -34
- package/types.d.ts +5 -34
package/package.json
CHANGED
package/types.d.cts
CHANGED
|
@@ -87,40 +87,11 @@ export type PhoneNumberType = 'PREMIUM_RATE' | 'TOLL_FREE' | 'SHARED_COST' | 'VO
|
|
|
87
87
|
*/
|
|
88
88
|
export type NumberType = PhoneNumberType | undefined;
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// a `NationalNumber` or an `Extension` or a `CarrierCode` or a `CountryCallingCode`.
|
|
96
|
-
//
|
|
97
|
-
// Example:
|
|
98
|
-
//
|
|
99
|
-
// import type { E164Number, CarrierCode } from 'libphonenumber-js'
|
|
100
|
-
// const number: E164Number = '+78005553535'
|
|
101
|
-
// const carrierCode: CarrierCode = number
|
|
102
|
-
//
|
|
103
|
-
// Shows an error:
|
|
104
|
-
// Type 'E164Number' is not assignable to type 'CarrierCode'.
|
|
105
|
-
//
|
|
106
|
-
// Originally, the `__tag` property was declared optional in order to allow passing
|
|
107
|
-
// a generic `string` in place of a `Tagged` type argument to functions that receive such arguments:
|
|
108
|
-
// that would allow ingesting generic `string` values from an outside source such as a database.
|
|
109
|
-
// Without that, those externally-obtained `string` values would have to be forcefully converted
|
|
110
|
-
// to the `Tagged` type via TypeScript `as` operator which is an anti-pattern.
|
|
111
|
-
//
|
|
112
|
-
// Later, it has been decided to make the `__tag` property non-optional and instead
|
|
113
|
-
// declare the arguments of those functions as `string | Tagged` rather than just `Tagged`:
|
|
114
|
-
// that would still allow ingesting generic `string` values from an outside source
|
|
115
|
-
// and would also make the `Tagged` type more "type safe".
|
|
116
|
-
//
|
|
117
|
-
type Tagged<A, T> = A & { __tag: T };
|
|
118
|
-
|
|
119
|
-
export type E164Number = Tagged<string, "E164Number">;
|
|
120
|
-
export type NationalNumber = Tagged<string, "NationalNumber">;
|
|
121
|
-
export type Extension = Tagged<string, "Extension">;
|
|
122
|
-
export type CarrierCode = Tagged<string, "CarrierCode">;
|
|
123
|
-
export type CountryCallingCode = Tagged<string, "CountryCallingCode">;
|
|
90
|
+
export type E164Number = string;
|
|
91
|
+
export type NationalNumber = string;
|
|
92
|
+
export type Extension = string;
|
|
93
|
+
export type CarrierCode = string;
|
|
94
|
+
export type CountryCallingCode = string;
|
|
124
95
|
|
|
125
96
|
type FormatExtension = (formattedNumber: string, extension: Extension, metadata: MetadataJson) => string
|
|
126
97
|
|
package/types.d.ts
CHANGED
|
@@ -87,40 +87,11 @@ export type PhoneNumberType = 'PREMIUM_RATE' | 'TOLL_FREE' | 'SHARED_COST' | 'VO
|
|
|
87
87
|
*/
|
|
88
88
|
export type NumberType = PhoneNumberType | undefined;
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// a `NationalNumber` or an `Extension` or a `CarrierCode` or a `CountryCallingCode`.
|
|
96
|
-
//
|
|
97
|
-
// Example:
|
|
98
|
-
//
|
|
99
|
-
// import type { E164Number, CarrierCode } from 'libphonenumber-js'
|
|
100
|
-
// const number: E164Number = '+78005553535'
|
|
101
|
-
// const carrierCode: CarrierCode = number
|
|
102
|
-
//
|
|
103
|
-
// Shows an error:
|
|
104
|
-
// Type 'E164Number' is not assignable to type 'CarrierCode'.
|
|
105
|
-
//
|
|
106
|
-
// Originally, the `__tag` property was declared optional in order to allow passing
|
|
107
|
-
// a generic `string` in place of a `Tagged` type argument to functions that receive such arguments:
|
|
108
|
-
// that would allow ingesting generic `string` values from an outside source such as a database.
|
|
109
|
-
// Without that, those externally-obtained `string` values would have to be forcefully converted
|
|
110
|
-
// to the `Tagged` type via TypeScript `as` operator which is an anti-pattern.
|
|
111
|
-
//
|
|
112
|
-
// Later, it has been decided to make the `__tag` property non-optional and instead
|
|
113
|
-
// declare the arguments of those functions as `string | Tagged` rather than just `Tagged`:
|
|
114
|
-
// that would still allow ingesting generic `string` values from an outside source
|
|
115
|
-
// and would also make the `Tagged` type more "type safe".
|
|
116
|
-
//
|
|
117
|
-
type Tagged<A, T> = A & { __tag: T };
|
|
118
|
-
|
|
119
|
-
export type E164Number = Tagged<string, "E164Number">;
|
|
120
|
-
export type NationalNumber = Tagged<string, "NationalNumber">;
|
|
121
|
-
export type Extension = Tagged<string, "Extension">;
|
|
122
|
-
export type CarrierCode = Tagged<string, "CarrierCode">;
|
|
123
|
-
export type CountryCallingCode = Tagged<string, "CountryCallingCode">;
|
|
90
|
+
export type E164Number = string;
|
|
91
|
+
export type NationalNumber = string;
|
|
92
|
+
export type Extension = string;
|
|
93
|
+
export type CarrierCode = string;
|
|
94
|
+
export type CountryCallingCode = string;
|
|
124
95
|
|
|
125
96
|
type FormatExtension = (formattedNumber: string, extension: Extension, metadata: MetadataJson) => string
|
|
126
97
|
|