inferred-types 0.50.8 → 0.50.9

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.
@@ -12,6 +12,6 @@ export * from "./asString";
12
12
  export * from "./asChars";
13
13
  export * from "./ip6GroupExpansion";
14
14
  export * from "./csv";
15
+ export * from "./lookupCountry";
15
16
  export * from "./json";
16
- export * from "./lookupCountryName";
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC"}
@@ -12,5 +12,5 @@ export * from "./asString";
12
12
  export * from "./asChars";
13
13
  export * from "./ip6GroupExpansion";
14
14
  export * from "./csv";
15
+ export * from "./lookupCountry";
15
16
  export * from "./json";
16
- export * from "./lookupCountryName";
@@ -0,0 +1,32 @@
1
+ import { Iso3166_1_Alpha2, Iso3166_1_Alpha3, Iso3166_1_CountryCode, Iso3166_1_CountryName, Iso3166Alpha2Lookup, Iso3166Alpha3Lookup, Iso3166CodeLookup, Iso3166CountryLookup, Suggest } from "src/types/string-literals";
2
+ import { AsString } from "src/types/type-conversion";
3
+ /**
4
+ * **lookupCountryName**`(code)`
5
+ *
6
+ * Looks up a country name by either the alpha-2, alpha-3, or country code
7
+ * as defined by the [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
8
+ *
9
+ * - the ISO standard uses uppercase characters for Alpha2 and Alpha3 codes but
10
+ * this utility will handle upper or lowercase
11
+ * - it will correctly type the country name if the code passed in is a literal
12
+ * string (and a valid code)
13
+ *
14
+ * **Related:** `lookupCountryAlpha2()`, `lookupCountryAlpha3()`
15
+ */
16
+ export declare const lookupCountryName: <T extends Suggest<Iso3166_1_Alpha2 | Iso3166_1_Alpha3 | Iso3166_1_CountryCode>>(code: T) => Iso3166CountryLookup<Uppercase<AsString<T>>>;
17
+ /**
18
+ * Looks up the Alpha2 component of a [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)
19
+ * standard.
20
+ */
21
+ export declare const lookupCountryAlpha2: <T extends Suggest<Iso3166_1_Alpha3 | Iso3166_1_CountryCode | Iso3166_1_CountryName>>(code: T) => T extends Iso3166_1_CountryName ? Iso3166Alpha2Lookup<T> : Iso3166Alpha2Lookup<Uppercase<AsString<T>>>;
22
+ /**
23
+ * Looks up the Alpha3 component of a [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)
24
+ * standard.
25
+ */
26
+ export declare const lookupCountryAlpha3: <T extends Suggest<Iso3166_1_Alpha2 | Iso3166_1_CountryCode | Iso3166_1_CountryName>>(token: T) => T extends Iso3166_1_CountryName ? Iso3166Alpha3Lookup<T> : Iso3166Alpha3Lookup<Uppercase<AsString<T>>>;
27
+ /**
28
+ * Looks up the Alpha3 component of a [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)
29
+ * standard.
30
+ */
31
+ export declare const lookupCountryCode: <T extends Suggest<Iso3166_1_Alpha2 | Iso3166_1_Alpha3 | Iso3166_1_CountryName>>(token: T) => T extends Iso3166_1_CountryName ? Iso3166CodeLookup<T> : Iso3166CodeLookup<Uppercase<AsString<T>>>;
32
+ //# sourceMappingURL=lookupCountry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookupCountry.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/lookupCountry.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACR,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAiHrD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,GAAG,qBAAqB,CAAC,QACxG,CAAC,KAYS,oBAAoB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,CAAC,SAAS,OAAO,CAAC,gBAAgB,GAClC,qBAAqB,GACrB,qBAAqB,CACtB,QACO,CAAC,KAcS,CAAC,SAAS,qBAAqB,GAC7C,mBAAmB,CAAC,CAAC,CAAC,GACtB,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAC7C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,CAAC,SAAS,OAAO,CACf,gBAAgB,GAChB,qBAAqB,GACrB,qBAAqB,CACxB,SACQ,CAAC,KAcQ,CAAC,SAAS,qBAAqB,GAC7C,mBAAmB,CAAC,CAAC,CAAC,GACtB,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAC7C,CAAA;AAGD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,CAAC,SAAS,OAAO,CACf,gBAAgB,GAChB,gBAAgB,GAChB,qBAAqB,CACxB,SACQ,CAAC,KAcQ,CAAC,SAAS,qBAAqB,GAC7C,iBAAiB,CAAC,CAAC,CAAC,GACpB,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAA"}
@@ -0,0 +1,97 @@
1
+ import { isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryName, isNumber, isNumberLike } from "../type-guards";
2
+ import { ISO3166_1 } from "src/constants/index";
3
+ import { uppercase } from "../literals";
4
+ const lookupAlpha2Code = (code, prop) => {
5
+ const found = ISO3166_1.find(i => i["alpha2"] === code);
6
+ return (found ? found[prop] : undefined);
7
+ };
8
+ const lookupAlpha3Code = (code, prop) => {
9
+ const found = ISO3166_1.find(i => i["alpha3"] === code);
10
+ return (found ? found[prop] : undefined);
11
+ };
12
+ const lookupName = (name, prop) => {
13
+ const found = ISO3166_1.find(i => i["name"] === name);
14
+ return (found ? found[prop] : undefined);
15
+ };
16
+ const lookupNumericCode = (code, prop) => {
17
+ let num = isNumber(code) ? `${code}` : code;
18
+ if (num.length === 1) {
19
+ num = `00${num}`;
20
+ }
21
+ else if (num.length === 2) {
22
+ num = `0${num}`;
23
+ }
24
+ const found = ISO3166_1.find(i => i["countryCode"] === num);
25
+ return found ? found[prop] : undefined;
26
+ };
27
+ /**
28
+ * **lookupCountryName**`(code)`
29
+ *
30
+ * Looks up a country name by either the alpha-2, alpha-3, or country code
31
+ * as defined by the [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
32
+ *
33
+ * - the ISO standard uses uppercase characters for Alpha2 and Alpha3 codes but
34
+ * this utility will handle upper or lowercase
35
+ * - it will correctly type the country name if the code passed in is a literal
36
+ * string (and a valid code)
37
+ *
38
+ * **Related:** `lookupCountryAlpha2()`, `lookupCountryAlpha3()`
39
+ */
40
+ export const lookupCountryName = (code) => {
41
+ const uc = uppercase(code);
42
+ return (isNumberLike(code)
43
+ ? lookupNumericCode(code, "name")
44
+ : isIso3166Alpha2(uc)
45
+ ? lookupAlpha2Code(uc, "name")
46
+ : isIso3166Alpha3(uc)
47
+ ? lookupAlpha3Code(uc, "name")
48
+ : undefined);
49
+ };
50
+ /**
51
+ * Looks up the Alpha2 component of a [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)
52
+ * standard.
53
+ */
54
+ export const lookupCountryAlpha2 = (code) => {
55
+ const uc = uppercase(code);
56
+ return (isNumberLike(code)
57
+ ? lookupNumericCode(code, "alpha2")
58
+ : isIso3166Alpha2(uc)
59
+ ? lookupAlpha2Code(uc, "alpha2")
60
+ : isIso3166Alpha3(uc)
61
+ ? lookupAlpha3Code(uc, "alpha2")
62
+ : isIso3166CountryName(code)
63
+ ? lookupName(code, "alpha2")
64
+ : undefined);
65
+ };
66
+ /**
67
+ * Looks up the Alpha3 component of a [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)
68
+ * standard.
69
+ */
70
+ export const lookupCountryAlpha3 = (token) => {
71
+ const uc = uppercase(token);
72
+ return (isNumberLike(token)
73
+ ? lookupNumericCode(token, "alpha3")
74
+ : isIso3166Alpha2(uc)
75
+ ? lookupAlpha2Code(uc, "alpha3")
76
+ : isIso3166Alpha3(uc)
77
+ ? lookupAlpha3Code(uc, "alpha3")
78
+ : isIso3166CountryName(token)
79
+ ? lookupName(token, "alpha3")
80
+ : undefined);
81
+ };
82
+ /**
83
+ * Looks up the Alpha3 component of a [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)
84
+ * standard.
85
+ */
86
+ export const lookupCountryCode = (token) => {
87
+ const uc = uppercase(token);
88
+ return (isNumberLike(token)
89
+ ? lookupNumericCode(token, "countryCode")
90
+ : isIso3166Alpha2(uc)
91
+ ? lookupAlpha2Code(uc, "countryCode")
92
+ : isIso3166Alpha3(uc)
93
+ ? lookupAlpha3Code(uc, "countryCode")
94
+ : isIso3166CountryName(token)
95
+ ? lookupName(token, "countryCode")
96
+ : undefined);
97
+ };
@@ -1,4 +1,4 @@
1
- import { Iso3166_1_Alpha2, Iso3166_1_Alpha3, Iso3166_1_CountryCode } from "src/types/index";
1
+ import { Iso3166_1_Alpha2, Iso3166_1_Alpha3, Iso3166_1_CountryCode, Iso3166_1_CountryName } from "src/types/index";
2
2
  /**
3
3
  * Type guard which checks whether `val` is a 2 character country
4
4
  * representation found in the ISO3166-1 standard.
@@ -14,4 +14,8 @@ export declare const isIso3166Alpha3: (val: unknown) => val is Iso3166_1_Alpha3;
14
14
  * representation found in the ISO3166-1 standard.
15
15
  */
16
16
  export declare const isIso3166CountryCode: (val: unknown) => val is Iso3166_1_CountryCode;
17
+ /**
18
+ * Type guard which checks whether `val` is a valid ISO3166-1 country name.
19
+ */
20
+ export declare const isIso3166CountryName: (val: unknown) => val is Iso3166_1_CountryName;
17
21
  //# sourceMappingURL=isIso3166Alpha2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isIso3166Alpha2.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/countries/isIso3166Alpha2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI5F;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,OAAO,KAAG,GAAG,IAAI,gBAGrD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,OAAO,KAAG,GAAG,IAAI,gBAGrD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAS,OAAO,KAAG,GAAG,IAAI,qBAG1D,CAAA"}
1
+ {"version":3,"file":"isIso3166Alpha2.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/countries/isIso3166Alpha2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAInH;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,OAAO,KAAG,GAAG,IAAI,gBAGrD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,OAAO,KAAG,GAAG,IAAI,gBAGrD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAS,OAAO,KAAG,GAAG,IAAI,qBAG1D,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAAS,OAAO,KAAG,GAAG,IAAI,qBAG1D,CAAA"}
@@ -24,3 +24,10 @@ export const isIso3166CountryCode = (val) => {
24
24
  const codes = ISO3166_1.map(i => i["countryCode"]);
25
25
  return isString(val) && codes.includes(val);
26
26
  };
27
+ /**
28
+ * Type guard which checks whether `val` is a valid ISO3166-1 country name.
29
+ */
30
+ export const isIso3166CountryName = (val) => {
31
+ const codes = ISO3166_1.map(i => i["name"]);
32
+ return isString(val) && codes.includes(val);
33
+ };
@@ -2,6 +2,7 @@ import { ISO3166_1 } from "src/constants/index";
2
2
  import { If, IsEqual, IsStringLiteral } from "src/types/boolean-logic";
3
3
  import { AfterFirst, First } from "src/types/lists";
4
4
  export type Iso3166_1_Lookup = typeof ISO3166_1;
5
+ type Props = "alpha2" | "alpha3" | "countryCode" | "name";
5
6
  /**
6
7
  * **Iso3166_1_Alpha2**
7
8
  *
@@ -30,37 +31,69 @@ export type Iso3166_1_CountryCode = {
30
31
  [K in keyof Iso3166_1_Lookup]: "countryCode" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["countryCode"] : never;
31
32
  }[number];
32
33
  /**
33
- * **CountryName**
34
+ * **Iso3166_1_Alpha3**
34
35
  *
35
- * A union of all country names found in the ISO3166-1 standard.
36
+ * A union of all 2 character country codes defined by the ISO3166-1
37
+ * standard.
36
38
  */
37
- export type CountryName = {
39
+ export type Iso3166_1_CountryName = {
38
40
  [K in keyof Iso3166_1_Lookup]: "name" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["name"] : never;
39
41
  }[number];
42
+ /**
43
+ * Any identifying aspect of an ISO3166-1 country (alpha2, alpha3, code, name)
44
+ */
45
+ export type Iso3166_1_Token = Iso3166_1_Alpha2 | Iso3166_1_Alpha3 | Iso3166_1_CountryCode | Iso3166_1_CountryName;
40
46
  type LookupAlpha2<T extends Iso3166_1_Alpha2, Lookup extends readonly {
41
47
  name: string;
42
48
  alpha2: string;
43
49
  alpha3: string;
44
50
  countryCode: string;
45
- }[], Match extends Iso3166_1_CountryCode | undefined = undefined> = [] extends Lookup ? Match : T extends First<Lookup>["alpha2"] ? First<Lookup>["name"] : LookupAlpha2<T, AfterFirst<Lookup>, Match>;
51
+ }[], Prop extends Props> = [] extends Lookup ? undefined : T extends First<Lookup>["alpha2"] ? First<Lookup>[`${Prop}`] : LookupAlpha2<T, AfterFirst<Lookup>, Prop>;
46
52
  type LookupAlpha3<T extends Iso3166_1_Alpha3, Lookup extends readonly {
47
53
  name: string;
48
54
  alpha2: string;
49
55
  alpha3: string;
50
56
  countryCode: string;
51
- }[], Match extends Iso3166_1_CountryCode | undefined = undefined> = [] extends Lookup ? Match : T extends First<Lookup>["alpha3"] ? First<Lookup>["name"] : LookupAlpha3<T, AfterFirst<Lookup>, Match>;
57
+ }[], Prop extends Props> = [] extends Lookup ? undefined : T extends First<Lookup>["alpha3"] ? First<Lookup>[`${Prop}`] : LookupAlpha3<T, AfterFirst<Lookup>, Prop>;
52
58
  type LookupCountryCode<T extends Iso3166_1_CountryCode, Lookup extends readonly {
53
59
  name: string;
54
60
  alpha2: string;
55
61
  alpha3: string;
56
62
  countryCode: string;
57
- }[], Match extends Iso3166_1_CountryCode | undefined = undefined> = [] extends Lookup ? Match : T extends First<Lookup>["countryCode"] ? First<Lookup>["name"] : LookupCountryCode<T, AfterFirst<Lookup>, Match>;
63
+ }[], Prop extends Props> = [] extends Lookup ? undefined : T extends First<Lookup>["countryCode"] ? First<Lookup>[`${Prop}`] : LookupCountryCode<T, AfterFirst<Lookup>, Prop>;
64
+ type LookupCountryName<T extends Iso3166_1_CountryName, Lookup extends readonly {
65
+ name: string;
66
+ alpha2: string;
67
+ alpha3: string;
68
+ countryCode: string;
69
+ }[], Prop extends Props> = [] extends Lookup ? undefined : T extends First<Lookup>["name"] ? First<Lookup>[`${Prop}`] : LookupCountryName<T, AfterFirst<Lookup>, Prop>;
58
70
  /**
59
71
  * **Iso3166Country**`<T>`
60
72
  *
61
73
  * Provides the ISO3166-1 **country name** if provided a valid lookup value (
62
74
  * aka, a alpha-2, alpha-3, or country code). If not valid returns _undefined_.
63
75
  */
64
- export type Iso3166Country<T> = T extends number ? Iso3166Country<`${T}`> : T extends string ? IsStringLiteral<T> extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2<T, Iso3166_1_Lookup> : T extends Iso3166_1_Alpha3 ? LookupAlpha3<T, Iso3166_1_Lookup> : T extends Iso3166_1_CountryCode ? LookupCountryCode<T, Iso3166_1_Lookup> : IsStringLiteral<T> extends true ? undefined : If<IsEqual<T, string>, Iso3166_1_CountryCode | undefined, undefined> : undefined : undefined;
76
+ export type Iso3166CountryLookup<T> = T extends number ? Iso3166CountryLookup<`${T}`> : T extends string ? IsStringLiteral<T> extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2<T, Iso3166_1_Lookup, "name"> : T extends Iso3166_1_Alpha3 ? LookupAlpha3<T, Iso3166_1_Lookup, "name"> : T extends Iso3166_1_CountryCode ? LookupCountryCode<T, Iso3166_1_Lookup, "name"> : T extends Iso3166_1_CountryName ? LookupCountryName<T, Iso3166_1_Lookup, "name"> : IsStringLiteral<T> extends true ? undefined : If<IsEqual<T, string>, Iso3166_1_CountryCode | undefined, undefined> : undefined : undefined;
77
+ /**
78
+ * **Iso3166Alpha2Lookup**`<T>`
79
+ *
80
+ * Provides the ISO3166-1 **Alpha 2** code if provided a valid lookup value (
81
+ * aka, a alpha-3, country code, or country name). If not valid returns _undefined_.
82
+ */
83
+ export type Iso3166Alpha2Lookup<T> = T extends number ? Iso3166CountryLookup<`${T}`> : T extends string ? IsStringLiteral<T> extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2<T, Iso3166_1_Lookup, "alpha2"> : T extends Iso3166_1_Alpha3 ? LookupAlpha3<T, Iso3166_1_Lookup, "alpha2"> : T extends Iso3166_1_CountryCode ? LookupCountryCode<T, Iso3166_1_Lookup, "alpha2"> : T extends Iso3166_1_CountryName ? LookupCountryName<T, Iso3166_1_Lookup, "alpha2"> : IsStringLiteral<T> extends true ? undefined : If<IsEqual<T, string>, Iso3166_1_Alpha2 | undefined, undefined> : undefined : undefined;
84
+ /**
85
+ * **Iso3166Alpha33Lookup**`<T>`
86
+ *
87
+ * Provides the ISO3166-1 **Alpha 3** code if provided a valid lookup value (
88
+ * aka, a alpha-3, country code, or country name). If not valid returns _undefined_.
89
+ */
90
+ export type Iso3166Alpha3Lookup<T> = T extends number ? Iso3166CountryLookup<`${T}`> : T extends string ? IsStringLiteral<T> extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2<T, Iso3166_1_Lookup, "alpha3"> : T extends Iso3166_1_Alpha3 ? LookupAlpha3<T, Iso3166_1_Lookup, "alpha3"> : T extends Iso3166_1_CountryCode ? LookupCountryCode<T, Iso3166_1_Lookup, "alpha3"> : T extends Iso3166_1_CountryName ? LookupCountryName<T, Iso3166_1_Lookup, "alpha3"> : IsStringLiteral<T> extends true ? undefined : If<IsEqual<T, string>, Iso3166_1_Alpha3 | undefined, undefined> : undefined : undefined;
91
+ /**
92
+ * **Iso3166Alpha33Lookup**`<T>`
93
+ *
94
+ * Provides the ISO3166-1 **Alpha 3** code if provided a valid lookup value (
95
+ * aka, a alpha-3, country code, or country name). If not valid returns _undefined_.
96
+ */
97
+ export type Iso3166CodeLookup<T> = T extends number ? Iso3166CountryLookup<`${T}`> : T extends string ? IsStringLiteral<T> extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2<T, Iso3166_1_Lookup, "countryCode"> : T extends Iso3166_1_Alpha3 ? LookupAlpha3<T, Iso3166_1_Lookup, "countryCode"> : T extends Iso3166_1_CountryCode ? LookupCountryCode<T, Iso3166_1_Lookup, "countryCode"> : T extends Iso3166_1_CountryName ? LookupCountryName<T, Iso3166_1_Lookup, "countryCode"> : IsStringLiteral<T> extends true ? undefined : If<IsEqual<T, string>, Iso3166_1_CountryCode | undefined, undefined> : undefined : undefined;
65
98
  export {};
66
99
  //# sourceMappingURL=Country.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Country.d.ts","sourceRoot":"","sources":["../../../../src/types/string-literals/character-sets/Country.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAG,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,MAAM,gBAAgB,GAAG,OAAO,SAAS,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;KAC5B,CAAC,IAAI,MAAM,gBAAgB,GAAG,QAAQ,SAAS,MAAM,gBAAgB,CAAC,CAAC,CAAC,GACrE,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAC7B,KAAK;CACV,CAAC,MAAM,CAAC,CAAC;AAEV;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;KAC5B,CAAC,IAAI,MAAM,gBAAgB,GAAG,QAAQ,SA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