inferred-types 0.50.6 → 0.50.7

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 (31) hide show
  1. package/dist/constants/ISO3166.d.ts +462 -748
  2. package/dist/constants/ISO3166.d.ts.map +1 -1
  3. package/dist/constants/ISO3166.js +142 -1
  4. package/dist/constants/tsconfig.tsbuildinfo +1 -1
  5. package/dist/index.cjs +184 -253
  6. package/dist/index.js +181 -253
  7. package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
  8. package/dist/runtime/tsconfig.tsbuildinfo +1 -1
  9. package/dist/runtime/type-conversion/index.d.ts +1 -0
  10. package/dist/runtime/type-conversion/index.d.ts.map +1 -1
  11. package/dist/runtime/type-conversion/index.js +1 -0
  12. package/dist/runtime/type-conversion/lookupCountryName.d.ts +15 -0
  13. package/dist/runtime/type-conversion/lookupCountryName.d.ts.map +1 -0
  14. package/dist/runtime/type-conversion/lookupCountryName.js +40 -0
  15. package/dist/runtime/type-guards/countries/isIso3166Alpha2.d.ts +12 -2
  16. package/dist/runtime/type-guards/countries/isIso3166Alpha2.d.ts.map +1 -1
  17. package/dist/runtime/type-guards/countries/isIso3166Alpha2.js +17 -1
  18. package/dist/runtime/type-guards/isNumericString.d.ts +9 -3
  19. package/dist/runtime/type-guards/isNumericString.d.ts.map +1 -1
  20. package/dist/runtime/type-guards/isNumericString.js +12 -5
  21. package/dist/runtime/type-guards/network-tg.d.ts +1 -1
  22. package/dist/types/boolean-logic/operators/IsNumberLike.d.ts +10 -0
  23. package/dist/types/boolean-logic/operators/IsNumberLike.d.ts.map +1 -0
  24. package/dist/types/boolean-logic/operators/IsNumberLike.js +1 -0
  25. package/dist/types/boolean-logic/operators/index.d.ts +1 -0
  26. package/dist/types/boolean-logic/operators/index.d.ts.map +1 -1
  27. package/dist/types/boolean-logic/operators/index.js +1 -0
  28. package/dist/types/string-literals/character-sets/Country.d.ts +49 -3
  29. package/dist/types/string-literals/character-sets/Country.d.ts.map +1 -1
  30. package/dist/types/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +1 -1
@@ -13,4 +13,5 @@ export * from "./asChars";
13
13
  export * from "./ip6GroupExpansion";
14
14
  export * from "./csv";
15
15
  export * from "./json";
16
+ export * from "./lookupCountryName";
16
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"}
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"}
@@ -13,3 +13,4 @@ export * from "./asChars";
13
13
  export * from "./ip6GroupExpansion";
14
14
  export * from "./csv";
15
15
  export * from "./json";
16
+ export * from "./lookupCountryName";
@@ -0,0 +1,15 @@
1
+ import { Iso3166_1_Alpha2, Iso3166_1_Alpha3, Iso3166_1_CountryCode, Iso3166Country, 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
+ export declare const lookupCountryName: <T extends Suggest<Iso3166_1_Alpha2 | Iso3166_1_Alpha3 | Iso3166_1_CountryCode>>(code: T) => Iso3166Country<Uppercase<AsString<T>>>;
15
+ //# sourceMappingURL=lookupCountryName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookupCountryName.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/lookupCountryName.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAG/H,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAwBrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,GAAG,qBAAqB,CAAC,QACxG,CAAC,KAYS,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACtD,CAAA"}
@@ -0,0 +1,40 @@
1
+ import { isIso3166Alpha2, isIso3166Alpha3, isNumber, isNumberLike } from "../type-guards";
2
+ import { ISO3166_1 } from "src/constants/ISO3166";
3
+ import { uppercase } from "../literals";
4
+ const lookupAlpha2Code = (code) => {
5
+ return ISO3166_1.find(i => i["alpha2"] === code)?.name;
6
+ };
7
+ const lookupAlpha3Code = (code) => {
8
+ return ISO3166_1.find(i => i["alpha3"] === code)?.name;
9
+ };
10
+ const lookupNumericCode = (code) => {
11
+ let num = isNumber(code) ? `${code}` : code;
12
+ if (num.length === 1) {
13
+ num = `00${num}`;
14
+ }
15
+ else if (num.length === 2) {
16
+ num = `0${num}`;
17
+ }
18
+ return ISO3166_1.find(i => i["countryCode"] === num)?.name;
19
+ };
20
+ /**
21
+ * **lookupCountryName**`(code)`
22
+ *
23
+ * Looks up a country name by either the alpha-2, alpha-3, or country code
24
+ * as defined by the [ISO3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
25
+ *
26
+ * - the ISO standard uses uppercase characters for Alpha2 and Alpha3 codes but
27
+ * this utility will handle upper or lowercase
28
+ * - it will correctly type the country name if the code passed in is a literal
29
+ * string (and a valid code)
30
+ */
31
+ export const lookupCountryName = (code) => {
32
+ const uc = uppercase(code);
33
+ return (isNumberLike(code)
34
+ ? lookupNumericCode(code)
35
+ : isIso3166Alpha2(uc)
36
+ ? lookupAlpha2Code(uc)
37
+ : isIso3166Alpha3(uc)
38
+ ? lookupAlpha3Code(uc)
39
+ : undefined);
40
+ };
@@ -1,7 +1,17 @@
1
- import { Iso3166_1 } from "src/types/index";
1
+ import { Iso3166_1_Alpha2, Iso3166_1_Alpha3, Iso3166_1_CountryCode } 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.
5
5
  */
6
- export declare const isIso3166Alpha2: (val: unknown) => val is Iso3166_1;
6
+ export declare const isIso3166Alpha2: (val: unknown) => val is Iso3166_1_Alpha2;
7
+ /**
8
+ * Type guard which checks whether `val` is a 3 character country
9
+ * representation found in the ISO3166-1 standard.
10
+ */
11
+ export declare const isIso3166Alpha3: (val: unknown) => val is Iso3166_1_Alpha3;
12
+ /**
13
+ * Type guard which checks whether `val` is a 3 character country
14
+ * representation found in the ISO3166-1 standard.
15
+ */
16
+ export declare const isIso3166CountryCode: (val: unknown) => val is Iso3166_1_CountryCode;
7
17
  //# 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,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,OAAO,KAAG,GAAG,IAAI,SAGrD,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,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"}
@@ -5,6 +5,22 @@ import { ISO3166_1 } from "src/constants/ISO3166";
5
5
  * representation found in the ISO3166-1 standard.
6
6
  */
7
7
  export const isIso3166Alpha2 = (val) => {
8
- const codes = ISO3166_1.map(i => i["alpha-2"]);
8
+ const codes = ISO3166_1.map(i => i["alpha2"]);
9
+ return isString(val) && codes.includes(val);
10
+ };
11
+ /**
12
+ * Type guard which checks whether `val` is a 3 character country
13
+ * representation found in the ISO3166-1 standard.
14
+ */
15
+ export const isIso3166Alpha3 = (val) => {
16
+ const codes = ISO3166_1.map(i => i["alpha3"]);
17
+ return isString(val) && codes.includes(val);
18
+ };
19
+ /**
20
+ * Type guard which checks whether `val` is a 3 character country
21
+ * representation found in the ISO3166-1 standard.
22
+ */
23
+ export const isIso3166CountryCode = (val) => {
24
+ const codes = ISO3166_1.map(i => i["countryCode"]);
9
25
  return isString(val) && codes.includes(val);
10
26
  };
@@ -1,15 +1,21 @@
1
+ import { NumberLike } from "src/types/numeric-literals";
1
2
  /**
2
3
  * **isNumericString**(value)
3
4
  *
4
5
  * Type guard to validate that a value is string which can be converted to a number.
5
6
  *
6
- * @deprecated use `isNumberLike<T>` instead
7
+ * **Related:** `isNumberLike`
7
8
  */
8
9
  export declare function isNumericString<T>(value: T): value is T & `${number}`;
9
10
  /**
10
11
  * **isNumberLike**(value)
11
12
  *
12
- * Type guard to validate that a value is string which can be converted to a number.
13
+ * Type guard to validate that a value is either:
14
+ *
15
+ * - a numeric string literal which can be converted to a number
16
+ * - an actual number
17
+ *
18
+ * **Related:** `isNumericString`
13
19
  */
14
- export declare function isNumberLike<T>(value: T): value is T & `${number}`;
20
+ export declare function isNumberLike<T>(value: T): value is T & NumberLike;
15
21
  //# sourceMappingURL=isNumericString.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isNumericString.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isNumericString.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,GAAG,MAAM,EAAE,CAKrE;AAGD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,GAAG,MAAM,EAAE,CAOlE"}
1
+ {"version":3,"file":"isNumericString.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isNumericString.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,GAAG,MAAM,EAAE,CAMrE;AAGD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,UAAU,CAQjE"}
@@ -5,18 +5,25 @@ import { split } from "../literals/split";
5
5
  *
6
6
  * Type guard to validate that a value is string which can be converted to a number.
7
7
  *
8
- * @deprecated use `isNumberLike<T>` instead
8
+ * **Related:** `isNumberLike`
9
9
  */
10
10
  export function isNumericString(value) {
11
- const validChars = [...NUMERIC_CHAR, "x", "E"];
12
- return typeof value === "string" && split(value).every(i => validChars.includes(i));
11
+ const numericChars = [...NUMERIC_CHAR];
12
+ return typeof value === "string" && (split(value).every(i => numericChars.includes(i)));
13
13
  }
14
14
  /**
15
15
  * **isNumberLike**(value)
16
16
  *
17
- * Type guard to validate that a value is string which can be converted to a number.
17
+ * Type guard to validate that a value is either:
18
+ *
19
+ * - a numeric string literal which can be converted to a number
20
+ * - an actual number
21
+ *
22
+ * **Related:** `isNumericString`
18
23
  */
19
24
  export function isNumberLike(value) {
20
25
  const numericChars = [...NUMERIC_CHAR];
21
- return typeof value === "string" && (split(value).every(i => numericChars.includes(i)));
26
+ return typeof value === "string" && (split(value).every(i => numericChars.includes(i)))
27
+ ? true
28
+ : typeof value === "number" ? true : false;
22
29
  }
@@ -43,7 +43,7 @@ export declare const isDomainName: <T>(val: T) => val is T & DomainName<AsString
43
43
  * Type guard which checks whether the value is a valid URL source
44
44
  * (aka, an IP address or a Domain Name)
45
45
  */
46
- export declare const isUrlSource: <T>(val: T) => val is (T & DomainName<AsString<T>>) | (T & (`${number}.${number}.${number}.${number}` | `0${string}:${string}` | `1${string}:${string}` | `2${string}:${string}` | `3${string}:${string}` | `4${string}:${string}` | `5${string}:${string}` | `6${string}:${string}` | `7${string}:${string}` | `8${string}:${string}` | `9${string}:${string}` | `E${string}:${string}` | `A${string}:${string}` | `B${string}:${string}` | `C${string}:${string}` | `D${string}:${string}` | `F${string}:${string}` | `a${string}:${string}` | `b${string}:${string}` | `c${string}:${string}` | `d${string}:${string}` | `e${string}:${string}` | `f${string}:${string}`));
46
+ export declare const isUrlSource: <T>(val: T) => val is (T & DomainName<AsString<T>>) | (T & (`${number}.${number}.${number}.${number}` | `0${string}:${string}` | `1${string}:${string}` | `2${string}:${string}` | `3${string}:${string}` | `4${string}:${string}` | `5${string}:${string}` | `6${string}:${string}` | `7${string}:${string}` | `8${string}:${string}` | `9${string}:${string}` | `A${string}:${string}` | `B${string}:${string}` | `C${string}:${string}` | `D${string}:${string}` | `E${string}:${string}` | `F${string}:${string}` | `a${string}:${string}` | `b${string}:${string}` | `c${string}:${string}` | `d${string}:${string}` | `e${string}:${string}` | `f${string}:${string}`));
47
47
  /**
48
48
  * **hasUrlQueryParameter**`(val,prop)`
49
49
  *
@@ -0,0 +1,10 @@
1
+ import { DoesExtend } from "./DoesExtend";
2
+ import { IsNever } from "./IsNever";
3
+ import { IsNumber } from "./IsNumber";
4
+ /**
5
+ * **IsNumberLike**`<T>`
6
+ *
7
+ * Boolean operator which validates that `T` is a number or `${number}`
8
+ */
9
+ export type IsNumberLike<T> = IsNever<T> extends true ? false : IsNumber<T> extends true ? true : DoesExtend<T, `${number}`> extends true ? true : false;
10
+ //# sourceMappingURL=IsNumberLike.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IsNumberLike.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/IsNumberLike.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,GACnD,KAAK,GACL,QAAQ,CAAC,CAAC,CAAC,SAAS,IAAI,GACxB,IAAI,GACJ,UAAU,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,SAAS,IAAI,GACvC,IAAI,GACJ,KAAK,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -100,4 +100,5 @@ export * from "./HaveSameNumericSign";
100
100
  export * from "./HasArray";
101
101
  export * from "./UnionHasArray";
102
102
  export * from "./MaybeError";
103
+ export * from "./IsNumberLike";
103
104
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/operators/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cA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,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAC"}
@@ -100,3 +100,4 @@ export * from "./HaveSameNumericSign";
100
100
  export * from "./HasArray";
101
101
  export * from "./UnionHasArray";
102
102
  export * from "./MaybeError";
103
+ export * from "./IsNumberLike";
@@ -1,13 +1,33 @@
1
1
  import { ISO3166_1 } from "src/constants/index";
2
+ import { If, IsEqual, IsStringLiteral } from "src/types/boolean-logic";
3
+ import { AfterFirst, First } from "src/types/lists";
2
4
  export type Iso3166_1_Lookup = typeof ISO3166_1;
3
5
  /**
4
- * **Iso3166_1**
6
+ * **Iso3166_1_Alpha2**
5
7
  *
6
8
  * A union of all 2 character country codes defined by the ISO3166-1
7
9
  * standard.
8
10
  */
9
- export type Iso3166_1 = {
10
- [K in keyof Iso3166_1_Lookup]: "alpha-2" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["alpha-2"] : never;
11
+ export type Iso3166_1_Alpha2 = {
12
+ [K in keyof Iso3166_1_Lookup]: "alpha2" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["alpha2"] : never;
13
+ }[number];
14
+ /**
15
+ * **Iso3166_1_Alpha3**
16
+ *
17
+ * A union of all 2 character country codes defined by the ISO3166-1
18
+ * standard.
19
+ */
20
+ export type Iso3166_1_Alpha3 = {
21
+ [K in keyof Iso3166_1_Lookup]: "alpha3" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["alpha3"] : never;
22
+ }[number];
23
+ /**
24
+ * **Iso3166_1_Alpha3**
25
+ *
26
+ * A union of all 2 character country codes defined by the ISO3166-1
27
+ * standard.
28
+ */
29
+ export type Iso3166_1_CountryCode = {
30
+ [K in keyof Iso3166_1_Lookup]: "countryCode" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["countryCode"] : never;
11
31
  }[number];
12
32
  /**
13
33
  * **CountryName**
@@ -17,4 +37,30 @@ export type Iso3166_1 = {
17
37
  export type CountryName = {
18
38
  [K in keyof Iso3166_1_Lookup]: "name" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["name"] : never;
19
39
  }[number];
40
+ type LookupAlpha2<T extends Iso3166_1_Alpha2, Lookup extends readonly {
41
+ name: string;
42
+ alpha2: string;
43
+ alpha3: string;
44
+ 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>;
46
+ type LookupAlpha3<T extends Iso3166_1_Alpha3, Lookup extends readonly {
47
+ name: string;
48
+ alpha2: string;
49
+ alpha3: string;
50
+ 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>;
52
+ type LookupCountryCode<T extends Iso3166_1_CountryCode, Lookup extends readonly {
53
+ name: string;
54
+ alpha2: string;
55
+ alpha3: string;
56
+ 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>;
58
+ /**
59
+ * **Iso3166Country**`<T>`
60
+ *
61
+ * Provides the ISO3166-1 **country name** if provided a valid lookup value (
62
+ * aka, a alpha-2, alpha-3, or country code). If not valid returns _undefined_.
63
+ */
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;
65
+ export {};
20
66
  //# 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;AAEhD,MAAM,MAAM,gBAAgB,GAAG,OAAO,SAAS,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;KACrB,CAAC,IAAI,MAAM,gBAAgB,GAAG,SAAS,SAAS,MAAM,gBAAgB,CAAC,CAAC,CAAC,GACtE,gBAAgB,CAAC,CAAC,CAAC,C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