Skip to content

Commit 60a2134

Browse files
committedMay 19, 2023
Add masterborn
1 parent 0a17340 commit 60a2134

File tree

3 files changed

+159
-95
lines changed

3 files changed

+159
-95
lines changed
 

‎README.md

+75-48
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,32 @@
4545
4646
#### Go to [zod.js.org](https://zod.js.org) >> -->
4747

48+
- [Table of contents](#table-of-contents)
4849
- [Introduction](#introduction)
4950
- [Sponsors](#sponsors)
51+
- [Gold](#gold)
52+
- [Silver](#silver)
53+
- [Bronze](#bronze)
5054
- [Ecosystem](#ecosystem)
55+
- [Resources](#resources)
56+
- [API libraries](#api-libraries)
57+
- [Form integrations](#form-integrations)
58+
- [Zod to X](#zod-to-x)
59+
- [X to Zod](#x-to-zod)
60+
- [Mocking](#mocking)
61+
- [Powered by Zod](#powered-by-zod)
62+
- [Utilities for Zod](#utilities-for-zod)
5163
- [Installation](#installation)
5264
- [Requirements](#requirements)
53-
- [Node/npm](#from-npm-nodebun)
54-
- [Deno](#from-denolandx-deno)
65+
- [From `npm` (Node/Bun)](#from-npm-nodebun)
66+
- [From `deno.land/x` (Deno)](#from-denolandx-deno)
5567
- [Basic usage](#basic-usage)
5668
- [Primitives](#primitives)
5769
- [Coercion for primitives](#coercion-for-primitives)
5870
- [Literals](#literals)
5971
- [Strings](#strings)
60-
- [Datetime](#iso-datetimes)
61-
- [IP](#ip-addresses)
72+
- [ISO datetimes](#iso-datetimes)
73+
- [IP addresses](#ip-addresses)
6274
- [Numbers](#numbers)
6375
- [BigInts](#bigints)
6476
- [NaNs](#nans)
@@ -69,66 +81,82 @@
6981
- [Optionals](#optionals)
7082
- [Nullables](#nullables)
7183
- [Objects](#objects)
72-
- [.shape](#shape)
73-
- [.keyof](#keyof)
74-
- [.extend](#extend)
75-
- [.merge](#merge)
76-
- [.pick/.omit](#pickomit)
77-
- [.partial](#partial)
78-
- [.deepPartial](#deepPartial)
79-
- [.passthrough](#passthrough)
80-
- [.strict](#strict)
81-
- [.strip](#strip)
82-
- [.catchall](#catchall)
84+
- [`.shape`](#shape)
85+
- [`.keyof`](#keyof)
86+
- [`.extend`](#extend)
87+
- [`.merge`](#merge)
88+
- [`.pick/.omit`](#pickomit)
89+
- [`.partial`](#partial)
90+
- [`.deepPartial`](#deeppartial)
91+
- [`.required`](#required)
92+
- [`.passthrough`](#passthrough)
93+
- [`.strict`](#strict)
94+
- [`.strip`](#strip)
95+
- [`.catchall`](#catchall)
8396
- [Arrays](#arrays)
84-
- [.element](#element)
85-
- [.nonempty](#nonempty)
86-
- [.min/.max/.length](#minmaxlength)
97+
- [`.element`](#element)
98+
- [`.nonempty`](#nonempty)
99+
- [`.min/.max/.length`](#minmaxlength)
87100
- [Tuples](#tuples)
88101
- [Unions](#unions)
89-
- [Discriminated Unions](#discriminated-unions)
102+
- [Discriminated unions](#discriminated-unions)
90103
- [Records](#records)
104+
- [Record key type](#record-key-type)
91105
- [Maps](#maps)
92106
- [Sets](#sets)
93107
- [Intersections](#intersections)
94108
- [Recursive types](#recursive-types)
109+
- [ZodType with ZodEffects](#zodtype-with-zodeffects)
95110
- [JSON type](#json-type)
96-
- [Cyclical data](#cyclical-objects)
111+
- [Cyclical objects](#cyclical-objects)
97112
- [Promises](#promises)
98113
- [Instanceof](#instanceof)
99114
- [Functions](#functions)
100115
- [Preprocess](#preprocess)
101-
- [Custom](#custom-schemas)
116+
- [Custom schemas](#custom-schemas)
102117
- [Schema methods](#schema-methods)
103-
- [.parse](#parse)
104-
- [.parseAsync](#parseasync)
105-
- [.safeParse](#safeparse)
106-
- [.safeParseAsync](#safeparseasync)
107-
- [.refine](#refine)
108-
- [.superRefine](#superRefine)
109-
- [.transform](#transform)
110-
- [.default](#default)
111-
- [.describe](#describe)
112-
- [.catch](#catch)
113-
- [.optional](#optional)
114-
- [.nullable](#nullable)
115-
- [.nullish](#nullish)
116-
- [.array](#array)
117-
- [.promise](#promise)
118-
- [.or](#or)
119-
- [.and](#and)
120-
- [.brand](#brand)
121-
- [.pipe](#pipe)
118+
- [`.parse`](#parse)
119+
- [`.parseAsync`](#parseasync)
120+
- [`.safeParse`](#safeparse)
121+
- [`.safeParseAsync`](#safeparseasync)
122+
- [`.refine`](#refine)
123+
- [Arguments](#arguments)
124+
- [Customize error path](#customize-error-path)
125+
- [Asynchronous refinements](#asynchronous-refinements)
126+
- [Relationship to transforms](#relationship-to-transforms)
127+
- [`.superRefine`](#superrefine)
128+
- [Abort early](#abort-early)
129+
- [Type refinements](#type-refinements)
130+
- [`.transform`](#transform)
131+
- [Chaining order](#chaining-order)
132+
- [Validating during transform](#validating-during-transform)
133+
- [Relationship to refinements](#relationship-to-refinements)
134+
- [Async transforms](#async-transforms)
135+
- [`.default`](#default)
136+
- [`.describe`](#describe)
137+
- [`.catch`](#catch)
138+
- [`.optional`](#optional)
139+
- [`.nullable`](#nullable)
140+
- [`.nullish`](#nullish)
141+
- [`.array`](#array)
142+
- [`.promise`](#promise)
143+
- [`.or`](#or)
144+
- [`.and`](#and)
145+
- [`.brand`](#brand)
146+
- [`.pipe()`](#pipe)
147+
- [You can use `.pipe()` to fix common issues with `z.coerce`.](#you-can-use-pipe-to-fix-common-issues-with-zcoerce)
122148
- [Guides and concepts](#guides-and-concepts)
123149
- [Type inference](#type-inference)
124150
- [Writing generic functions](#writing-generic-functions)
151+
- [Constraining allowable inputs](#constraining-allowable-inputs)
125152
- [Error handling](#error-handling)
126153
- [Error formatting](#error-formatting)
127154
- [Comparison](#comparison)
128155
- [Joi](#joi)
129156
- [Yup](#yup)
130157
- [io-ts](#io-ts)
131158
- [Runtypes](#runtypes)
159+
- [Ow](#ow)
132160
- [Changelog](#changelog)
133161

134162
<!-- **Zod 2 is coming! Follow [@colinhacks](https://twitter.com/colinhacks) to stay updated and discuss the future of Zod.** -->
@@ -386,17 +414,16 @@ Sponsorship at any level is appreciated and encouraged. For individual developer
386414
<a href="https://ill.inc/">ill.inc</a>
387415
<br />
388416
</td>
389-
<!-- <td align="center">
390-
<a href="https://www.avanawallet.com/">
391-
<img src="https://avatars.githubusercontent.com/u/105452197?s=200&v=4" width="100px;" alt="Avana Wallet logo"/>
417+
<td align="center">
418+
<a href="https://www.masterborn.com/career?utm_source=github&utm_medium=referral&utm_campaign=zodsponsoring">
419+
<img src="https://avatars.githubusercontent.com/u/48984031?s=200&v=4" width="100px;" alt="MasterBorn logo"/>
392420
</a>
393421
<br />
394-
<b>Avana Wallet</b>
422+
<b>MasterBorn</b>
395423
<br/>
396-
<a href="https://www.avanawallet.com/">avanawallet.com</a><br/>
397-
<span>Solana non-custodial wallet</span>
424+
<a href="https://www.masterborn.com/career?utm_source=github&utm_medium=referral&utm_campaign=zodsponsoring">masterborn.com</a>
398425
<br />
399-
</td> -->
426+
</td>
400427
</tr>
401428
</table>
402429

@@ -462,7 +489,7 @@ There are a growing number of tools that are built atop or support Zod natively!
462489

463490
- [`@anatine/zod-mock`](https://github.com/anatine/zod-plugins/tree/main/packages/zod-mock): Generate mock data from a Zod schema. Powered by [faker.js](https://github.com/faker-js/faker).
464491
- [`zod-mocking`](https://github.com/dipasqualew/zod-mocking): Generate mock data from your Zod schemas.
465-
- [`zocker`](https://zocker.sigrist.dev): Generate plausible mock-data from your schemas.
492+
- [`zocker`](https://zocker.sigrist.dev): Generate plausible mock-data from your schemas.
466493

467494
#### Powered by Zod
468495

‎deno/lib/README.md

+74-47
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,32 @@
4545
4646
#### Go to [zod.js.org](https://zod.js.org) >> -->
4747

48+
- [Table of contents](#table-of-contents)
4849
- [Introduction](#introduction)
4950
- [Sponsors](#sponsors)
51+
- [Gold](#gold)
52+
- [Silver](#silver)
53+
- [Bronze](#bronze)
5054
- [Ecosystem](#ecosystem)
55+
- [Resources](#resources)
56+
- [API libraries](#api-libraries)
57+
- [Form integrations](#form-integrations)
58+
- [Zod to X](#zod-to-x)
59+
- [X to Zod](#x-to-zod)
60+
- [Mocking](#mocking)
61+
- [Powered by Zod](#powered-by-zod)
62+
- [Utilities for Zod](#utilities-for-zod)
5163
- [Installation](#installation)
5264
- [Requirements](#requirements)
53-
- [Node/npm](#from-npm-nodebun)
54-
- [Deno](#from-denolandx-deno)
65+
- [From `npm` (Node/Bun)](#from-npm-nodebun)
66+
- [From `deno.land/x` (Deno)](#from-denolandx-deno)
5567
- [Basic usage](#basic-usage)
5668
- [Primitives](#primitives)
5769
- [Coercion for primitives](#coercion-for-primitives)
5870
- [Literals](#literals)
5971
- [Strings](#strings)
60-
- [Datetime](#datetime-validation)
61-
- [IP](#ip-address-validation)
72+
- [ISO datetimes](#iso-datetimes)
73+
- [IP addresses](#ip-addresses)
6274
- [Numbers](#numbers)
6375
- [BigInts](#bigints)
6476
- [NaNs](#nans)
@@ -69,66 +81,82 @@
6981
- [Optionals](#optionals)
7082
- [Nullables](#nullables)
7183
- [Objects](#objects)
72-
- [.shape](#shape)
73-
- [.keyof](#keyof)
74-
- [.extend](#extend)
75-
- [.merge](#merge)
76-
- [.pick/.omit](#pickomit)
77-
- [.partial](#partial)
78-
- [.deepPartial](#deepPartial)
79-
- [.passthrough](#passthrough)
80-
- [.strict](#strict)
81-
- [.strip](#strip)
82-
- [.catchall](#catchall)
84+
- [`.shape`](#shape)
85+
- [`.keyof`](#keyof)
86+
- [`.extend`](#extend)
87+
- [`.merge`](#merge)
88+
- [`.pick/.omit`](#pickomit)
89+
- [`.partial`](#partial)
90+
- [`.deepPartial`](#deeppartial)
91+
- [`.required`](#required)
92+
- [`.passthrough`](#passthrough)
93+
- [`.strict`](#strict)
94+
- [`.strip`](#strip)
95+
- [`.catchall`](#catchall)
8396
- [Arrays](#arrays)
84-
- [.element](#element)
85-
- [.nonempty](#nonempty)
86-
- [.min/.max/.length](#minmaxlength)
97+
- [`.element`](#element)
98+
- [`.nonempty`](#nonempty)
99+
- [`.min/.max/.length`](#minmaxlength)
87100
- [Tuples](#tuples)
88101
- [Unions](#unions)
89-
- [Discriminated Unions](#discriminated-unions)
102+
- [Discriminated unions](#discriminated-unions)
90103
- [Records](#records)
104+
- [Record key type](#record-key-type)
91105
- [Maps](#maps)
92106
- [Sets](#sets)
93107
- [Intersections](#intersections)
94108
- [Recursive types](#recursive-types)
109+
- [ZodType with ZodEffects](#zodtype-with-zodeffects)
95110
- [JSON type](#json-type)
96-
- [Cyclical data](#cyclical-objects)
111+
- [Cyclical objects](#cyclical-objects)
97112
- [Promises](#promises)
98113
- [Instanceof](#instanceof)
99114
- [Functions](#functions)
100115
- [Preprocess](#preprocess)
101-
- [Custom](#custom-schemas)
116+
- [Custom schemas](#custom-schemas)
102117
- [Schema methods](#schema-methods)
103-
- [.parse](#parse)
104-
- [.parseAsync](#parseasync)
105-
- [.safeParse](#safeparse)
106-
- [.safeParseAsync](#safeparseasync)
107-
- [.refine](#refine)
108-
- [.superRefine](#superRefine)
109-
- [.transform](#transform)
110-
- [.default](#default)
111-
- [.describe](#describe)
112-
- [.catch](#catch)
113-
- [.optional](#optional)
114-
- [.nullable](#nullable)
115-
- [.nullish](#nullish)
116-
- [.array](#array)
117-
- [.promise](#promise)
118-
- [.or](#or)
119-
- [.and](#and)
120-
- [.brand](#brand)
121-
- [.pipe](#pipe)
118+
- [`.parse`](#parse)
119+
- [`.parseAsync`](#parseasync)
120+
- [`.safeParse`](#safeparse)
121+
- [`.safeParseAsync`](#safeparseasync)
122+
- [`.refine`](#refine)
123+
- [Arguments](#arguments)
124+
- [Customize error path](#customize-error-path)
125+
- [Asynchronous refinements](#asynchronous-refinements)
126+
- [Relationship to transforms](#relationship-to-transforms)
127+
- [`.superRefine`](#superrefine)
128+
- [Abort early](#abort-early)
129+
- [Type refinements](#type-refinements)
130+
- [`.transform`](#transform)
131+
- [Chaining order](#chaining-order)
132+
- [Validating during transform](#validating-during-transform)
133+
- [Relationship to refinements](#relationship-to-refinements)
134+
- [Async transforms](#async-transforms)
135+
- [`.default`](#default)
136+
- [`.describe`](#describe)
137+
- [`.catch`](#catch)
138+
- [`.optional`](#optional)
139+
- [`.nullable`](#nullable)
140+
- [`.nullish`](#nullish)
141+
- [`.array`](#array)
142+
- [`.promise`](#promise)
143+
- [`.or`](#or)
144+
- [`.and`](#and)
145+
- [`.brand`](#brand)
146+
- [`.pipe()`](#pipe)
147+
- [You can use `.pipe()` to fix common issues with `z.coerce`.](#you-can-use-pipe-to-fix-common-issues-with-zcoerce)
122148
- [Guides and concepts](#guides-and-concepts)
123149
- [Type inference](#type-inference)
124150
- [Writing generic functions](#writing-generic-functions)
151+
- [Constraining allowable inputs](#constraining-allowable-inputs)
125152
- [Error handling](#error-handling)
126153
- [Error formatting](#error-formatting)
127154
- [Comparison](#comparison)
128155
- [Joi](#joi)
129156
- [Yup](#yup)
130157
- [io-ts](#io-ts)
131158
- [Runtypes](#runtypes)
159+
- [Ow](#ow)
132160
- [Changelog](#changelog)
133161

134162
<!-- **Zod 2 is coming! Follow [@colinhacks](https://twitter.com/colinhacks) to stay updated and discuss the future of Zod.** -->
@@ -386,17 +414,16 @@ Sponsorship at any level is appreciated and encouraged. For individual developer
386414
<a href="https://ill.inc/">ill.inc</a>
387415
<br />
388416
</td>
389-
<!-- <td align="center">
390-
<a href="https://www.avanawallet.com/">
391-
<img src="https://avatars.githubusercontent.com/u/105452197?s=200&v=4" width="100px;" alt="Avana Wallet logo"/>
417+
<td align="center">
418+
<a href="https://www.masterborn.com/career?utm_source=github&utm_medium=referral&utm_campaign=zodsponsoring">
419+
<img src="https://avatars.githubusercontent.com/u/48984031?s=200&v=4" width="100px;" alt="MasterBorn logo"/>
392420
</a>
393421
<br />
394-
<b>Avana Wallet</b>
422+
<b>MasterBorn</b>
395423
<br/>
396-
<a href="https://www.avanawallet.com/">avanawallet.com</a><br/>
397-
<span>Solana non-custodial wallet</span>
424+
<a href="https://www.masterborn.com/career?utm_source=github&utm_medium=referral&utm_campaign=zodsponsoring">masterborn.com</a>
398425
<br />
399-
</td> -->
426+
</td>
400427
</tr>
401428
</table>
402429

‎playground.ts

+10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
import { z } from "./src";
22
z;
33

4+
console.log(
5+
z
6+
.string()
7+
.toUpperCase()
8+
.pipe(z.enum(["DE", "EN"]))
9+
.parse("de")
10+
);
11+
412
function recursive<T extends z.ZodTypeAny>(
513
callback: <G extends z.ZodTypeAny>(schema: G) => T
614
): T {
715
return "asdf" as any;
816
}
917

18+
z.string();
19+
1020
const cat = recursive((type) => {
1121
return z.object({
1222
name: z.string(),

0 commit comments

Comments
 (0)
Please sign in to comment.