Comparing version 2.0.0-beta.21 to 2.0.0-beta.22
@@ -8,3 +8,3 @@ # Changelog | ||
| zod@1.9 | Added z.instanceof() and z.custom(). Implemented ZodSchema.array() method. | | ||
| zod@1.8 | Introduced z.void(). Major overhaul to error handling system, including the introduction of custom error maps. Wrote new [error handling guide](https://github.com/vriad/zod/blob/master/ERROR_HANDLING.md). | | ||
| zod@1.8 | Introduced z.void(). Major overhaul to error handling system, including the introduction of custom error maps. Wrote new [error handling guide](https://github.com/colinhacks/zod/blob/master/ERROR_HANDLING.md). | | ||
| zod@1.7 | Added several built-in validators to string, number, and array schemas. Calls to `.refine` now return new instance. | | ||
@@ -11,0 +11,0 @@ | zod@1.5 | Any and unknown types | |
@@ -106,2 +106,3 @@ "use strict"; | ||
var PseudoPromise_1 = require("./PseudoPromise"); | ||
var index_1 = require("./index"); | ||
exports.getParsedType = function (data) { | ||
@@ -421,3 +422,3 @@ if (typeof data === 'string') | ||
? shape[key] | ||
: !(def.catchall.constructor.name === 'ZodNever') | ||
: !(def.catchall instanceof index_1.ZodNever) | ||
? def.catchall | ||
@@ -466,3 +467,3 @@ : undefined; | ||
} | ||
if (def.catchall.constructor.name === 'ZodNever') { | ||
if (def.catchall instanceof index_1.ZodNever) { | ||
if (def.unknownKeys === 'passthrough') { | ||
@@ -469,0 +470,0 @@ try { |
{ | ||
"name": "zod", | ||
"version": "2.0.0-beta.21", | ||
"version": "2.0.0-beta.22", | ||
"description": "TypeScript-first schema declaration and validation library with static type inference", | ||
@@ -12,11 +12,11 @@ "main": "./lib/cjs/index.js", | ||
"type": "git", | ||
"url": "https://github.com/vriad/zod" | ||
"url": "https://github.com/colinhacks/zod" | ||
}, | ||
"author": "Colin McDonnell <colin@vriad.com>", | ||
"author": "Colin McDonnell <colin@colinhacks.com>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"bugs": { | ||
"url": "https://github.com/vriad/zod/issues" | ||
"url": "https://github.com/colinhacks/zod/issues" | ||
}, | ||
"homepage": "https://github.com/vriad/zod", | ||
"homepage": "https://github.com/colinhacks/zod", | ||
"dependencies": {}, | ||
@@ -23,0 +23,0 @@ "keywords": [ |
@@ -6,6 +6,6 @@ <p align="center"> | ||
<p align="center"> | ||
<a href="https://twitter.com/vriad" rel="nofollow"><img src="https://img.shields.io/badge/created%20by-@vriad-4BBAAB.svg" alt="Created by Colin McDonnell"></a> | ||
<a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/vriad/zod" alt="License"></a> | ||
<a href="https://twitter.com/colinhacks" rel="nofollow"><img src="https://img.shields.io/badge/created%20by-@colinhacks-4BBAAB.svg" alt="Created by Colin McDonnell"></a> | ||
<a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/colinhacks/zod" alt="License"></a> | ||
<a href="https://www.npmjs.com/package/zod" rel="nofollow"><img src="https://img.shields.io/npm/dw/zod.svg" alt="npm"></a> | ||
<a href="https://www.npmjs.com/package/zod" rel="nofollow"><img src="https://img.shields.io/github/stars/vriad/zod" alt="stars"></a> | ||
<a href="https://www.npmjs.com/package/zod" rel="nofollow"><img src="https://img.shields.io/github/stars/colinhacks/zod" alt="stars"></a> | ||
<a href="./src/__tests__" rel="nofollow"><img src="./coverage.svg" alt="coverage"></a> | ||
@@ -20,3 +20,3 @@ | ||
<!-- **Zod 2 is coming! Follow [@vriad](https://twitter.com/vriad) to stay updated and discuss the future of Zod.** --> | ||
<!-- **Zod 2 is coming! Follow [@colinhacks](https://twitter.com/colinhacks) to stay updated and discuss the future of Zod.** --> | ||
@@ -50,6 +50,6 @@ ### **Sept 17 — Zod 2 is now in beta!** | ||
- All schemas now have a `.safeParse` method. This lets you validate data in a more functional way, similar to `io-ts`: https://github.com/vriad/zod#safe-parse | ||
- String schemas have a new `.regex` refinement method: https://github.com/vriad/zod#strings | ||
- Object schemas now have two new methods: `.primitives()` and `.nonprimitives()`. These methods let you quickly pick or omit primitive fields from objects, useful for validating API inputs: https://github.com/vriad/zod#primitives-and-nonprimitives | ||
- Zod now provides `z.nativeEnum()`, which lets you create z Zod schema from an existing TypeScript `enum`: https://github.com/vriad/zod#native-enums | ||
- All schemas now have a `.safeParse` method. This lets you validate data in a more functional way, similar to `io-ts`: https://github.com/colinhacks/zod#safe-parse | ||
- String schemas have a new `.regex` refinement method: https://github.com/colinhacks/zod#strings | ||
- Object schemas now have two new methods: `.primitives()` and `.nonprimitives()`. These methods let you quickly pick or omit primitive fields from objects, useful for validating API inputs: https://github.com/colinhacks/zod#primitives-and-nonprimitives | ||
- Zod now provides `z.nativeEnum()`, which lets you create z Zod schema from an existing TypeScript `enum`: https://github.com/colinhacks/zod#native-enums | ||
@@ -76,3 +76,3 @@ <!-- > ⚠️ You might be encountering issues building your project if you're using zod@<1.10.2. This is the result of a bug in the TypeScript compiler. To solve this without updating, set `"skipLibCheck": true` in your tsconfig.json "compilerOptions". This issue is resolved in zod@1.10.2 and later. --> | ||
I work on Zod in my free time, so if you're making money from a product that is built with Zod, I'd massively appreciate sponsorship at any level. For solo devs, I recommend the [Chipotle Bowl tier](https://github.com/sponsors/vriad) or the [Cup of Coffee tier](https://github.com/sponsors/vriad). If you're making money from a product you built using Zod, consider the [Startup tier]([Cup of Coffee tier](https://github.com/sponsors/vriad)). You can learn more about the tiers at [github.com/sponsors/vriad](github.com/sponsors/vriad). | ||
I work on Zod in my free time, so if you're making money from a product that is built with Zod, I'd massively appreciate sponsorship at any level. For solo devs, I recommend the [Chipotle Bowl tier](https://github.com/sponsors/colinhacks) or the [Cup of Coffee tier](https://github.com/sponsors/colinhacks). If you're making money from a product you built using Zod, consider the [Startup tier]([Cup of Coffee tier](https://github.com/sponsors/colinhacks)). You can learn more about the tiers at [github.com/sponsors/colinhacks](github.com/sponsors/colinhacks). | ||
@@ -106,3 +106,3 @@ ### Sponsors | ||
_To get your name + Twitter + website here, sponsor Zod at the [Freelancer](https://github.com/sponsors/vriad) or [Consultancy](https://github.com/sponsors/vriad) tier._ | ||
_To get your name + Twitter + website here, sponsor Zod at the [Freelancer](https://github.com/sponsors/colinhacks) or [Consultancy](https://github.com/sponsors/colinhacks) tier._ | ||
@@ -472,3 +472,3 @@ # Table of contents | ||
> To see the email and url regexes, check out [this file](https://github.com/vriad/zod/blob/master/src/types/string.ts). To use a more advanced method, use a custom refinement. | ||
> To see the email and url regexes, check out [this file](https://github.com/colinhacks/zod/blob/master/src/types/string.ts). To use a more advanced method, use a custom refinement. | ||
@@ -1646,3 +1646,3 @@ ## Numbers | ||
There is a dedicated guide on Zod's error handling system here: [ERROR_HANDLING.md](https://github.com/vriad/zod/blob/master/ERROR_HANDLING.md) | ||
There is a dedicated guide on Zod's error handling system here: [ERROR_HANDLING.md](https://github.com/colinhacks/zod/blob/master/ERROR_HANDLING.md) | ||
@@ -1655,3 +1655,3 @@ # Comparison | ||
<!-- | Feature | [Zod](https://github.com/vriad) | [Joi](https://github.com/hapijs/joi) | [Yup](https://github.com/jquense/yup) | [io-ts](https://github.com/gcanti/io-ts) | [Runtypes](https://github.com/pelotom/runtypes) | [ow](https://github.com/sindresorhus/ow) | [class-validator](https://github.com/typestack/class-validator) | | ||
<!-- | Feature | [Zod](https://github.com/colinhacks) | [Joi](https://github.com/hapijs/joi) | [Yup](https://github.com/jquense/yup) | [io-ts](https://github.com/gcanti/io-ts) | [Runtypes](https://github.com/pelotom/runtypes) | [ow](https://github.com/sindresorhus/ow) | [class-validator](https://github.com/typestack/class-validator) | | ||
| ---------------------------------------------------------------------------------------------------------------------- | :-----------------------------: | :----------------------------------: | :-----------------------------------: | :--------------------------------------: | :---------------------------------------------: | :--------------------------------------: | :-------------------------------------------------------------: | | ||
@@ -1807,2 +1807,2 @@ | <abbr title='Any ability to extract a TypeScript type from a validator instance counts.'>Type inference</abbr> | 🟢 | 🔴 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | | ||
View the changelog at [CHANGELOG.md](https://github.com/vriad/zod/blob/master/CHANGELOG.md) | ||
View the changelog at [CHANGELOG.md](https://github.com/colinhacks/zod/blob/master/CHANGELOG.md) |
Sorry, the diff of this file is not supported yet
676679
9852