@infra-blocks/zod-utils 0.12.0 → 0.13.0-alpha.0
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/lib/cjs/index.d.ts +19 -1
- package/lib/cjs/index.js +31 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/iso/country-code.d.ts +12 -12
- package/lib/cjs/iso/country-code.js +12 -12
- package/lib/cjs/iso/country-code.js.map +1 -1
- package/lib/esm/index.d.ts +19 -1
- package/lib/esm/index.js +31 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/iso/country-code.d.ts +12 -12
- package/lib/esm/iso/country-code.js +12 -12
- package/lib/esm/iso/country-code.js.map +1 -1
- package/package.json +1 -1
package/lib/cjs/index.d.ts
CHANGED
|
@@ -11,9 +11,25 @@ declare function csv(): z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>
|
|
|
11
11
|
*
|
|
12
12
|
* @returns A string to int codec.
|
|
13
13
|
*
|
|
14
|
-
* @see https://zod.dev/codecs
|
|
14
|
+
* @see https://zod.dev/codecs#stringtoint
|
|
15
15
|
*/
|
|
16
16
|
declare function stringtoInt(): z.ZodCodec<z.ZodString, z.ZodInt>;
|
|
17
|
+
/**
|
|
18
|
+
* A string to URL codec, as defined in Zod's documentation.
|
|
19
|
+
*
|
|
20
|
+
* @returns A string to URL codec.
|
|
21
|
+
*
|
|
22
|
+
* @see https://zod.dev/codecs#stringtourl
|
|
23
|
+
*/
|
|
24
|
+
declare function stringToUrl(): z.ZodCodec<z.ZodURL, z.ZodCustom<import("url").URL, import("url").URL>>;
|
|
25
|
+
/**
|
|
26
|
+
* A string to HTTP URL codec, as defined in Zod's documentation.
|
|
27
|
+
*
|
|
28
|
+
* @returns A string to HTTP URL codec.
|
|
29
|
+
*
|
|
30
|
+
* @see https://zod.dev/codecs#stringtohttpurl
|
|
31
|
+
*/
|
|
32
|
+
declare function stringToHttpUrl(): z.ZodCodec<z.ZodURL, z.ZodCustom<import("url").URL, import("url").URL>>;
|
|
17
33
|
/**
|
|
18
34
|
* Returns a type guard function using the provided schema as the source of truth.
|
|
19
35
|
*
|
|
@@ -81,6 +97,8 @@ declare const zu: {
|
|
|
81
97
|
};
|
|
82
98
|
csv: typeof csv;
|
|
83
99
|
stringtoInt: typeof stringtoInt;
|
|
100
|
+
stringToHttpUrl: typeof stringToHttpUrl;
|
|
101
|
+
stringToUrl: typeof stringToUrl;
|
|
84
102
|
typeGuard: typeof typeGuard;
|
|
85
103
|
isValid: typeof isValid;
|
|
86
104
|
};
|
package/lib/cjs/index.js
CHANGED
|
@@ -25,11 +25,39 @@ const stringToIntCodec = zod_1.z.codec(zod_1.z.string().regex(zod_1.z.regexes.in
|
|
|
25
25
|
*
|
|
26
26
|
* @returns A string to int codec.
|
|
27
27
|
*
|
|
28
|
-
* @see https://zod.dev/codecs
|
|
28
|
+
* @see https://zod.dev/codecs#stringtoint
|
|
29
29
|
*/
|
|
30
30
|
function stringtoInt() {
|
|
31
31
|
return stringToIntCodec;
|
|
32
32
|
}
|
|
33
|
+
const stringToURLCodec = zod_1.z.codec(zod_1.z.url(), zod_1.z.instanceof(URL), {
|
|
34
|
+
decode: (urlString) => new URL(urlString),
|
|
35
|
+
encode: (url) => url.href,
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* A string to URL codec, as defined in Zod's documentation.
|
|
39
|
+
*
|
|
40
|
+
* @returns A string to URL codec.
|
|
41
|
+
*
|
|
42
|
+
* @see https://zod.dev/codecs#stringtourl
|
|
43
|
+
*/
|
|
44
|
+
function stringToUrl() {
|
|
45
|
+
return stringToURLCodec;
|
|
46
|
+
}
|
|
47
|
+
const stringToHttpURLCodec = zod_1.z.codec(zod_1.z.httpUrl(), zod_1.z.instanceof(URL), {
|
|
48
|
+
decode: (urlString) => new URL(urlString),
|
|
49
|
+
encode: (url) => url.href,
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* A string to HTTP URL codec, as defined in Zod's documentation.
|
|
53
|
+
*
|
|
54
|
+
* @returns A string to HTTP URL codec.
|
|
55
|
+
*
|
|
56
|
+
* @see https://zod.dev/codecs#stringtohttpurl
|
|
57
|
+
*/
|
|
58
|
+
function stringToHttpUrl() {
|
|
59
|
+
return stringToHttpURLCodec;
|
|
60
|
+
}
|
|
33
61
|
/**
|
|
34
62
|
* Returns a type guard function using the provided schema as the source of truth.
|
|
35
63
|
*
|
|
@@ -72,6 +100,8 @@ const zu = {
|
|
|
72
100
|
json: index_js_4.json,
|
|
73
101
|
csv,
|
|
74
102
|
stringtoInt,
|
|
103
|
+
stringToHttpUrl,
|
|
104
|
+
stringToUrl,
|
|
75
105
|
typeGuard,
|
|
76
106
|
isValid,
|
|
77
107
|
};
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,6BAAwB;AACxB,6CAAqC;AACrC,iDAA6C;AAC7C,6CAAqC;AACrC,8CAAuC;AAEvC,MAAM,SAAS,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhE,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAExB;;;;GAIG;AACH,SAAS,GAAG;IACV,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,gBAAgB,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAC,CAAC,GAAG,EAAE,EAAE;IAC7E,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC;IACzC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CA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AAC,OAAO,CAAC;AACzC,CAAC;AAED,MAAM,EAAE,GAAG;IACT,GAAG,EAAH,cAAG;IACH,OAAO,EAAP,kBAAO;IACP,GAAG,EAAH,cAAG;IACH,IAAI,EAAJ,eAAI;IACJ,GAAG;IACH,WAAW;IACX,eAAe;IACf,WAAW;IACX,SAAS;IACT,OAAO;CACR,CAAC;AAEO,gBAAE"}
|
|
@@ -3,19 +3,19 @@ declare const alpha3CodeSchema: z.core.$ZodBranded<z.ZodEnum<{
|
|
|
3
3
|
[x: string]: string;
|
|
4
4
|
}>, "IsoAlpha3CountryCode">;
|
|
5
5
|
export type IsoAlpha3CountryCode = z.infer<typeof alpha3CodeSchema>;
|
|
6
|
-
/**
|
|
7
|
-
* Returns a zod schema that validates that the input is a string that matches
|
|
8
|
-
* an ISO 3166 alpha 3 country code.
|
|
9
|
-
*
|
|
10
|
-
* The currency code is case-sensitive and all current currency codes are
|
|
11
|
-
* all uppercase.
|
|
12
|
-
*
|
|
13
|
-
* @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
|
|
14
|
-
* branded type as output.
|
|
15
|
-
*
|
|
16
|
-
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|
|
17
|
-
*/
|
|
18
6
|
export declare const countryCode: {
|
|
7
|
+
/**
|
|
8
|
+
* Returns a zod schema that validates that the input is a string that matches
|
|
9
|
+
* an ISO 3166 alpha 3 country code.
|
|
10
|
+
*
|
|
11
|
+
* The currency code is case-sensitive and all current currency codes are
|
|
12
|
+
* all uppercase.
|
|
13
|
+
*
|
|
14
|
+
* @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
|
|
15
|
+
* branded type as output.
|
|
16
|
+
*
|
|
17
|
+
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|
|
18
|
+
*/
|
|
19
19
|
alpha3: () => z.core.$ZodBranded<z.ZodEnum<{
|
|
20
20
|
[x: string]: string;
|
|
21
21
|
}>, "IsoAlpha3CountryCode">;
|
|
@@ -5,19 +5,19 @@ const iso_3166_1 = require("iso-3166");
|
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const ALPHA_3_CODES = iso_3166_1.iso31661.map((entry) => entry.alpha3);
|
|
7
7
|
const alpha3CodeSchema = zod_1.z.enum(ALPHA_3_CODES).brand("IsoAlpha3CountryCode");
|
|
8
|
-
/**
|
|
9
|
-
* Returns a zod schema that validates that the input is a string that matches
|
|
10
|
-
* an ISO 3166 alpha 3 country code.
|
|
11
|
-
*
|
|
12
|
-
* The currency code is case-sensitive and all current currency codes are
|
|
13
|
-
* all uppercase.
|
|
14
|
-
*
|
|
15
|
-
* @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
|
|
16
|
-
* branded type as output.
|
|
17
|
-
*
|
|
18
|
-
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|
|
19
|
-
*/
|
|
20
8
|
exports.countryCode = {
|
|
9
|
+
/**
|
|
10
|
+
* Returns a zod schema that validates that the input is a string that matches
|
|
11
|
+
* an ISO 3166 alpha 3 country code.
|
|
12
|
+
*
|
|
13
|
+
* The currency code is case-sensitive and all current currency codes are
|
|
14
|
+
* all uppercase.
|
|
15
|
+
*
|
|
16
|
+
* @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
|
|
17
|
+
* branded type as output.
|
|
18
|
+
*
|
|
19
|
+
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|
|
20
|
+
*/
|
|
21
21
|
alpha3: () => alpha3CodeSchema,
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=country-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../../src/iso/country-code.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AACpC,6BAAwB;AAExB,MAAM,aAAa,GAAG,mBAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,gBAAgB,GAAG,OAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../../src/iso/country-code.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AACpC,6BAAwB;AAExB,MAAM,aAAa,GAAG,mBAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,gBAAgB,GAAG,OAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAIhE,QAAA,WAAW,GAAG;IACzB;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,GAAG,EAAE,CAAC,gBAAgB;CAC/B,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -11,9 +11,25 @@ declare function csv(): z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>
|
|
|
11
11
|
*
|
|
12
12
|
* @returns A string to int codec.
|
|
13
13
|
*
|
|
14
|
-
* @see https://zod.dev/codecs
|
|
14
|
+
* @see https://zod.dev/codecs#stringtoint
|
|
15
15
|
*/
|
|
16
16
|
declare function stringtoInt(): z.ZodCodec<z.ZodString, z.ZodInt>;
|
|
17
|
+
/**
|
|
18
|
+
* A string to URL codec, as defined in Zod's documentation.
|
|
19
|
+
*
|
|
20
|
+
* @returns A string to URL codec.
|
|
21
|
+
*
|
|
22
|
+
* @see https://zod.dev/codecs#stringtourl
|
|
23
|
+
*/
|
|
24
|
+
declare function stringToUrl(): z.ZodCodec<z.ZodURL, z.ZodCustom<import("url").URL, import("url").URL>>;
|
|
25
|
+
/**
|
|
26
|
+
* A string to HTTP URL codec, as defined in Zod's documentation.
|
|
27
|
+
*
|
|
28
|
+
* @returns A string to HTTP URL codec.
|
|
29
|
+
*
|
|
30
|
+
* @see https://zod.dev/codecs#stringtohttpurl
|
|
31
|
+
*/
|
|
32
|
+
declare function stringToHttpUrl(): z.ZodCodec<z.ZodURL, z.ZodCustom<import("url").URL, import("url").URL>>;
|
|
17
33
|
/**
|
|
18
34
|
* Returns a type guard function using the provided schema as the source of truth.
|
|
19
35
|
*
|
|
@@ -81,6 +97,8 @@ declare const zu: {
|
|
|
81
97
|
};
|
|
82
98
|
csv: typeof csv;
|
|
83
99
|
stringtoInt: typeof stringtoInt;
|
|
100
|
+
stringToHttpUrl: typeof stringToHttpUrl;
|
|
101
|
+
stringToUrl: typeof stringToUrl;
|
|
84
102
|
typeGuard: typeof typeGuard;
|
|
85
103
|
isValid: typeof isValid;
|
|
86
104
|
};
|
package/lib/esm/index.js
CHANGED
|
@@ -22,11 +22,39 @@ const stringToIntCodec = z.codec(z.string().regex(z.regexes.integer), z.int(), {
|
|
|
22
22
|
*
|
|
23
23
|
* @returns A string to int codec.
|
|
24
24
|
*
|
|
25
|
-
* @see https://zod.dev/codecs
|
|
25
|
+
* @see https://zod.dev/codecs#stringtoint
|
|
26
26
|
*/
|
|
27
27
|
function stringtoInt() {
|
|
28
28
|
return stringToIntCodec;
|
|
29
29
|
}
|
|
30
|
+
const stringToURLCodec = z.codec(z.url(), z.instanceof(URL), {
|
|
31
|
+
decode: (urlString) => new URL(urlString),
|
|
32
|
+
encode: (url) => url.href,
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* A string to URL codec, as defined in Zod's documentation.
|
|
36
|
+
*
|
|
37
|
+
* @returns A string to URL codec.
|
|
38
|
+
*
|
|
39
|
+
* @see https://zod.dev/codecs#stringtourl
|
|
40
|
+
*/
|
|
41
|
+
function stringToUrl() {
|
|
42
|
+
return stringToURLCodec;
|
|
43
|
+
}
|
|
44
|
+
const stringToHttpURLCodec = z.codec(z.httpUrl(), z.instanceof(URL), {
|
|
45
|
+
decode: (urlString) => new URL(urlString),
|
|
46
|
+
encode: (url) => url.href,
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* A string to HTTP URL codec, as defined in Zod's documentation.
|
|
50
|
+
*
|
|
51
|
+
* @returns A string to HTTP URL codec.
|
|
52
|
+
*
|
|
53
|
+
* @see https://zod.dev/codecs#stringtohttpurl
|
|
54
|
+
*/
|
|
55
|
+
function stringToHttpUrl() {
|
|
56
|
+
return stringToHttpURLCodec;
|
|
57
|
+
}
|
|
30
58
|
/**
|
|
31
59
|
* Returns a type guard function using the provided schema as the source of truth.
|
|
32
60
|
*
|
|
@@ -69,6 +97,8 @@ const zu = {
|
|
|
69
97
|
json,
|
|
70
98
|
csv,
|
|
71
99
|
stringtoInt,
|
|
100
|
+
stringToHttpUrl,
|
|
101
|
+
stringToUrl,
|
|
72
102
|
typeGuard,
|
|
73
103
|
isValid,
|
|
74
104
|
};
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhE,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAExB;;;;GAIG;AACH,SAAS,GAAG;IACV,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CA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IAAI;CAC1B,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,eAAe;IACtB,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,SAAS,CAAsB,MAAS;IAC/C,OAAO,CAAC,KAAc,EAAuB,EAAE;QAC7C,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,OAAO,CACd,MAAS,EACT,KAAc;IAEd,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACzC,CAAC;AAED,MAAM,EAAE,GAAG;IACT,GAAG;IACH,OAAO;IACP,GAAG;IACH,IAAI;IACJ,GAAG;IACH,WAAW;IACX,eAAe;IACf,WAAW;IACX,SAAS;IACT,OAAO;CACR,CAAC;AAEF,OAAO,EAAE,EAAE,EAAE,CAAC"}
|
|
@@ -3,19 +3,19 @@ declare const alpha3CodeSchema: z.core.$ZodBranded<z.ZodEnum<{
|
|
|
3
3
|
[x: string]: string;
|
|
4
4
|
}>, "IsoAlpha3CountryCode">;
|
|
5
5
|
export type IsoAlpha3CountryCode = z.infer<typeof alpha3CodeSchema>;
|
|
6
|
-
/**
|
|
7
|
-
* Returns a zod schema that validates that the input is a string that matches
|
|
8
|
-
* an ISO 3166 alpha 3 country code.
|
|
9
|
-
*
|
|
10
|
-
* The currency code is case-sensitive and all current currency codes are
|
|
11
|
-
* all uppercase.
|
|
12
|
-
*
|
|
13
|
-
* @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
|
|
14
|
-
* branded type as output.
|
|
15
|
-
*
|
|
16
|
-
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|
|
17
|
-
*/
|
|
18
6
|
export declare const countryCode: {
|
|
7
|
+
/**
|
|
8
|
+
* Returns a zod schema that validates that the input is a string that matches
|
|
9
|
+
* an ISO 3166 alpha 3 country code.
|
|
10
|
+
*
|
|
11
|
+
* The currency code is case-sensitive and all current currency codes are
|
|
12
|
+
* all uppercase.
|
|
13
|
+
*
|
|
14
|
+
* @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
|
|
15
|
+
* branded type as output.
|
|
16
|
+
*
|
|
17
|
+
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|
|
18
|
+
*/
|
|
19
19
|
alpha3: () => z.core.$ZodBranded<z.ZodEnum<{
|
|
20
20
|
[x: string]: string;
|
|
21
21
|
}>, "IsoAlpha3CountryCode">;
|
|
@@ -2,19 +2,19 @@ import { iso31661 } from "iso-3166";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
const ALPHA_3_CODES = iso31661.map((entry) => entry.alpha3);
|
|
4
4
|
const alpha3CodeSchema = z.enum(ALPHA_3_CODES).brand("IsoAlpha3CountryCode");
|
|
5
|
-
/**
|
|
6
|
-
* Returns a zod schema that validates that the input is a string that matches
|
|
7
|
-
* an ISO 3166 alpha 3 country code.
|
|
8
|
-
*
|
|
9
|
-
* The currency code is case-sensitive and all current currency codes are
|
|
10
|
-
* all uppercase.
|
|
11
|
-
*
|
|
12
|
-
* @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
|
|
13
|
-
* branded type as output.
|
|
14
|
-
*
|
|
15
|
-
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|
|
16
|
-
*/
|
|
17
5
|
export const countryCode = {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a zod schema that validates that the input is a string that matches
|
|
8
|
+
* an ISO 3166 alpha 3 country code.
|
|
9
|
+
*
|
|
10
|
+
* The currency code is case-sensitive and all current currency codes are
|
|
11
|
+
* all uppercase.
|
|
12
|
+
*
|
|
13
|
+
* @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
|
|
14
|
+
* branded type as output.
|
|
15
|
+
*
|
|
16
|
+
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|
|
17
|
+
*/
|
|
18
18
|
alpha3: () => alpha3CodeSchema,
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=country-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../../src/iso/country-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAI7E
|
|
1
|
+
{"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../../src/iso/country-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAI7E,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,GAAG,EAAE,CAAC,gBAAgB;CAC/B,CAAC"}
|